Skip to content

Commit

Permalink
test: add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed May 3, 2022
1 parent 9e8bed3 commit 9ff03d7
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions test/locale-imports.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,29 @@ describe('locale imports', () => {
expect(faker.locale).toBe(locale);
});

// Internal test to cover `src/locale/*.ts`
it(`should be possible to directly require('../locale/${locale}')`, () => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { faker } = require(`../locale/${locale}`);
it(`should be possible to directly import('@faker-js/faker/locale/${locale}')`, async () => {
const { faker } = await import(`../dist/esm/locale/${locale}`);

expect(faker).toBeDefined();
expect(faker.locale).toBe(locale);
});

describe('Internal tests to cover `src/locale/*.ts`', () => {
it(`should be possible to directly require('../locale/${locale}')`, () => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { faker } = require(`../locale/${locale}`);

expect(faker).toBeDefined();
expect(faker.locale).toBe(locale);
});

it(`should be possible to directly import('../src/locale/${locale}')`, async () => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { faker } = await import(`../src/locale/${locale}`);

expect(faker).toBeDefined();
expect(faker.locale).toBe(locale);
});
});
}
});

0 comments on commit 9ff03d7

Please sign in to comment.