aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2024-09-10 01:01:17 +0200
committerGitHub <[email protected]>2024-09-09 23:01:17 +0000
commit18ab2c7b3c8fa78c46d4abafc07c3219f41caa46 (patch)
treef6aed0914e9792ce5580b70eb50df085bcc1a212 /test
parentacb8b5258fa645e499831fca43b319b0439c0baf (diff)
downloadfaker-18ab2c7b3c8fa78c46d4abafc07c3219f41caa46.tar.xz
faker-18ab2c7b3c8fa78c46d4abafc07c3219f41caa46.zip
chore: improve nullish-checks in tests (#3081)
Diffstat (limited to 'test')
-rw-r--r--test/all-functional.spec.ts2
-rw-r--r--test/support/seeded-runs.ts6
2 files changed, 6 insertions, 2 deletions
diff --git a/test/all-functional.spec.ts b/test/all-functional.spec.ts
index cd78678e..33d89312 100644
--- a/test/all-functional.spec.ts
+++ b/test/all-functional.spec.ts
@@ -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)
);
diff --git a/test/support/seeded-runs.ts b/test/support/seeded-runs.ts
index 19ef410f..a05f1854 100644
--- a/test/support/seeded-runs.ts
+++ b/test/support/seeded-runs.ts
@@ -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();
}