Skip to content

Commit

Permalink
chore: improve nullish-checks in tests (#3081)
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT committed Sep 9, 2024
1 parent acb8b52 commit 18ab2c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/all-functional.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const modules = getMethodNamesByModules(fakerEN);
describe('BROKEN_LOCALE_METHODS test', () => {
it('should not contain obsolete configuration (modules)', () => {
const existingModules = Object.keys(modules);
const configuredModules = Object.keys(BROKEN_LOCALE_METHODS ?? {});
const configuredModules = Object.keys(BROKEN_LOCALE_METHODS);
const obsoleteModules = configuredModules.filter(
(module) => !existingModules.includes(module)
);
Expand Down
6 changes: 5 additions & 1 deletion test/support/seeded-runs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,12 @@ class TestGenerator<
repetitions: number = 1
): void {
this.setup();
const callable = this.module[method];
if (callable == null) {
throw new Error(`Method ${method} not found in ${this.moduleName}`);
}

for (let i = 0; i < repetitions; i++) {
const callable = this.module[method];
const value = callable(...args);
expect(value).toMatchSnapshot();
}
Expand Down

0 comments on commit 18ab2c7

Please sign in to comment.