Skip to content

Commit

Permalink
test: add i18n regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate Moore committed May 18, 2022
1 parent 2573130 commit 4f307f7
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions packages/astro/test/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,6 @@ describe('astro cli', () => {
expect(proc.stdout).to.include(pkgVersion);
});

const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const LOCALES = ['en_US', 'sv_SE', 'es_419.UTF-8', 'es_ES@euro', 'C'];
LOCALES.forEach((locale) => {
it(`astro does NOT throw on "${locale}" locales`, async () => {
const projectRootURL = new URL('./fixtures/astro-basic/', import.meta.url);
const proc = cli('dev', '--root', fileURLToPath(projectRootURL), { extendEnv: false, env: { LANG: locale }});

await Promise.race([proc, sleep(5000).then(() => proc.kill(0))]);
expect(proc.exitCode).to.equal(0, ``);
});
})

it('astro build', async () => {
const projectRootURL = new URL('./fixtures/astro-basic/', import.meta.url);
const proc = await cli('build', '--root', fileURLToPath(projectRootURL));
Expand Down Expand Up @@ -122,3 +110,21 @@ describe('astro cli', () => {
});
});
});

describe('astro cli i18n', () => {
const LOCALES = ['en_US', 'sv_SE', 'es_419.UTF-8', 'es_ES@euro', 'C'];
LOCALES.forEach((locale) => {
it(`astro does NOT throw on "${locale}" locales`, async () => {
const projectRootURL = new URL('./fixtures/astro-basic/', import.meta.url);
let error = null;
try {
const proc = cli('dev', '--root', fileURLToPath(projectRootURL), { env: { LANG: locale }});
await parseCliDevStart(proc)
} catch (e) {
console.log(e);
error = e.message;
}
expect(error).to.be.null;
});
})
})

0 comments on commit 4f307f7

Please sign in to comment.