Skip to content

Commit ede6ffa

Browse files
authored
test: prepare test sources for strict mode (#2107)
1 parent 1cadfb9 commit ede6ffa

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

test/helpers.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,9 +791,8 @@ describe('helpers', () => {
791791
});
792792

793793
it('empty array returns empty array', () => {
794-
const input = [];
795794
const length = faker.number.int({ min: 1, max: 6 });
796-
const unique = faker.helpers.uniqueArray(input, length);
795+
const unique = faker.helpers.uniqueArray([], length);
797796
expect(unique).toHaveLength(0);
798797
});
799798

test/scripts/apidoc/signature.example.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class SignatureTest {
9494
* @param b The string parameter.
9595
*/
9696
optionalStringParamMethod(b?: string): number {
97-
return +b;
97+
return b ? 0 : 1;
9898
}
9999

100100
/**
@@ -114,7 +114,7 @@ export class SignatureTest {
114114
* @param c The boolean parameter.
115115
*/
116116
multiParamMethod(a: number, b?: string, c: boolean = true): number {
117-
return c ? a : +b;
117+
return c ? a : b ? 0 : 1;
118118
}
119119

120120
/**
@@ -143,7 +143,7 @@ export class SignatureTest {
143143
excludes?: ReadonlyArray<AlphaNumericChar>;
144144
}
145145
): string {
146-
return value + options.format;
146+
return options?.format ?? value;
147147
}
148148

149149
/**
@@ -195,7 +195,7 @@ export class SignatureTest {
195195
*/
196196
e: LiteralUnion<'a' | 'b'>;
197197
}): number {
198-
return options.c ? options.a : +options.b;
198+
return options.a;
199199
}
200200

201201
/**

test/support/seededRuns.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type NoArgsMethodOf<ObjectType> = MethodOf<ObjectType> &
3434
{
3535
[Key in MethodOf<ObjectType, () => unknown>]: ObjectType[Key] extends (
3636
arg0: string | number | boolean | Record<string, undefined>,
37-
...args
37+
...args: unknown[]
3838
) => unknown
3939
? Key
4040
: never;

vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default defineConfig({
1111
setupFiles: ['test/setup.ts'],
1212
coverage: {
1313
all: true,
14+
provider: 'c8',
1415
reporter: ['clover', 'cobertura', 'lcov', 'text'],
1516
include: ['src'],
1617
},

0 commit comments

Comments
 (0)