diff options
| author | Shinigami <[email protected]> | 2023-05-03 08:18:58 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-03 08:18:58 +0200 |
| commit | ede6ffac383a853c12b7a47cebbb031ba80627aa (patch) | |
| tree | 92f0632b03b9920c4e880fff2dd711a1142ed393 | |
| parent | 1cadfb97856da17047fcb5dcb504c3418eeed145 (diff) | |
| download | faker-ede6ffac383a853c12b7a47cebbb031ba80627aa.tar.xz faker-ede6ffac383a853c12b7a47cebbb031ba80627aa.zip | |
test: prepare test sources for strict mode (#2107)
| -rw-r--r-- | test/helpers.spec.ts | 3 | ||||
| -rw-r--r-- | test/scripts/apidoc/signature.example.ts | 8 | ||||
| -rw-r--r-- | test/support/seededRuns.ts | 2 | ||||
| -rw-r--r-- | vite.config.ts | 1 |
4 files changed, 7 insertions, 7 deletions
diff --git a/test/helpers.spec.ts b/test/helpers.spec.ts index 2dcb64aa..6cb397cb 100644 --- a/test/helpers.spec.ts +++ b/test/helpers.spec.ts @@ -791,9 +791,8 @@ describe('helpers', () => { }); it('empty array returns empty array', () => { - const input = []; const length = faker.number.int({ min: 1, max: 6 }); - const unique = faker.helpers.uniqueArray(input, length); + const unique = faker.helpers.uniqueArray([], length); expect(unique).toHaveLength(0); }); diff --git a/test/scripts/apidoc/signature.example.ts b/test/scripts/apidoc/signature.example.ts index 97db90c8..6bb835c1 100644 --- a/test/scripts/apidoc/signature.example.ts +++ b/test/scripts/apidoc/signature.example.ts @@ -94,7 +94,7 @@ export class SignatureTest { * @param b The string parameter. */ optionalStringParamMethod(b?: string): number { - return +b; + return b ? 0 : 1; } /** @@ -114,7 +114,7 @@ export class SignatureTest { * @param c The boolean parameter. */ multiParamMethod(a: number, b?: string, c: boolean = true): number { - return c ? a : +b; + return c ? a : b ? 0 : 1; } /** @@ -143,7 +143,7 @@ export class SignatureTest { excludes?: ReadonlyArray<AlphaNumericChar>; } ): string { - return value + options.format; + return options?.format ?? value; } /** @@ -195,7 +195,7 @@ export class SignatureTest { */ e: LiteralUnion<'a' | 'b'>; }): number { - return options.c ? options.a : +options.b; + return options.a; } /** diff --git a/test/support/seededRuns.ts b/test/support/seededRuns.ts index 1cfc7fdc..5926fb5c 100644 --- a/test/support/seededRuns.ts +++ b/test/support/seededRuns.ts @@ -34,7 +34,7 @@ type NoArgsMethodOf<ObjectType> = MethodOf<ObjectType> & { [Key in MethodOf<ObjectType, () => unknown>]: ObjectType[Key] extends ( arg0: string | number | boolean | Record<string, undefined>, - ...args + ...args: unknown[] ) => unknown ? Key : never; diff --git a/vite.config.ts b/vite.config.ts index cb3a67e3..25ffc589 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -11,6 +11,7 @@ export default defineConfig({ setupFiles: ['test/setup.ts'], coverage: { all: true, + provider: 'c8', reporter: ['clover', 'cobertura', 'lcov', 'text'], include: ['src'], }, |
