Skip to content

test: prepare test sources for strict mode #2107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions test/helpers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down
8 changes: 4 additions & 4 deletions test/scripts/apidoc/signature.example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class SignatureTest {
* @param b The string parameter.
*/
optionalStringParamMethod(b?: string): number {
return +b;
return b ? 0 : 1;
}

/**
Expand All @@ -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;
}

/**
Expand Down Expand Up @@ -143,7 +143,7 @@ export class SignatureTest {
excludes?: ReadonlyArray<AlphaNumericChar>;
}
): string {
return value + options.format;
return options?.format ?? value;
}

/**
Expand Down Expand Up @@ -195,7 +195,7 @@ export class SignatureTest {
*/
e: LiteralUnion<'a' | 'b'>;
}): number {
return options.c ? options.a : +options.b;
return options.a;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/support/seededRuns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default defineConfig({
setupFiles: ['test/setup.ts'],
coverage: {
all: true,
provider: 'c8',
reporter: ['clover', 'cobertura', 'lcov', 'text'],
include: ['src'],
},
Expand Down