Skip to content

Commit 18ab2c7

Browse files
authored
chore: improve nullish-checks in tests (#3081)
1 parent acb8b52 commit 18ab2c7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

test/all-functional.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const modules = getMethodNamesByModules(fakerEN);
8181
describe('BROKEN_LOCALE_METHODS test', () => {
8282
it('should not contain obsolete configuration (modules)', () => {
8383
const existingModules = Object.keys(modules);
84-
const configuredModules = Object.keys(BROKEN_LOCALE_METHODS ?? {});
84+
const configuredModules = Object.keys(BROKEN_LOCALE_METHODS);
8585
const obsoleteModules = configuredModules.filter(
8686
(module) => !existingModules.includes(module)
8787
);

test/support/seeded-runs.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,12 @@ class TestGenerator<
142142
repetitions: number = 1
143143
): void {
144144
this.setup();
145+
const callable = this.module[method];
146+
if (callable == null) {
147+
throw new Error(`Method ${method} not found in ${this.moduleName}`);
148+
}
149+
145150
for (let i = 0; i < repetitions; i++) {
146-
const callable = this.module[method];
147151
const value = callable(...args);
148152
expect(value).toMatchSnapshot();
149153
}

0 commit comments

Comments
 (0)