Skip to content

Commit

Permalink
fix: type issue
Browse files Browse the repository at this point in the history
  • Loading branch information
charIeszhao committed Oct 10, 2024
1 parent 21ed68c commit 91eddcc
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
10 changes: 5 additions & 5 deletions packages/client/src/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ export const idToken = 'id_token_value';

export const currentUnixTimeStamp = Date.now() / 1000;

export const mockFetchOidcConfig: (
delay?: number
) => Mock<unknown[], Promise<OidcConfigResponse>> = (delay = 0) =>
export const mockFetchOidcConfig: (delay?: number) => Mock<() => Promise<OidcConfigResponse>> = (
delay = 0
) =>
vi.fn(async () => {
await new Promise((resolve) => {
setTimeout(resolve, delay);
Expand All @@ -112,10 +112,10 @@ export const mockFetchOidcConfig: (
revocationEndpoint,
jwksUri,
issuer,
};
} satisfies OidcConfigResponse;
});

export const fetchOidcConfig: Mock<unknown[], Promise<OidcConfigResponse>> = mockFetchOidcConfig();
export const fetchOidcConfig: Mock<() => Promise<OidcConfigResponse>> = mockFetchOidcConfig();
export const requester = vi.fn();
export const failingRequester = vi.fn().mockRejectedValue(new Error('Failed request'));
export const navigate = vi.fn();
Expand Down
2 changes: 1 addition & 1 deletion packages/next-sample/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
2 changes: 1 addition & 1 deletion packages/next-server-actions-sample/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
5 changes: 1 addition & 4 deletions packages/sveltekit/src/__mocks__/@sveltejs/kit.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { type redirect as originalRedirect } from '@sveltejs/kit';
import { type Mock, vi } from 'vitest';

export const redirect: Mock<
Parameters<typeof originalRedirect>,
ReturnType<typeof originalRedirect>
> = vi.fn();
export const redirect: Mock<typeof originalRedirect> = vi.fn();
2 changes: 1 addition & 1 deletion packages/vue/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const getAccessToken = vi.fn(() => {
throw new Error('not authenticated');
});
const signIn = vi.fn();
const injectMock = vi.fn<string[], unknown>((): unknown => {
const injectMock = vi.fn((key: string): unknown => {
return undefined;
});
vi.mock('vue', async (importOriginal) => {
Expand Down

0 comments on commit 91eddcc

Please sign in to comment.