Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit add090a

Browse files
committed
fix: test case fix
1 parent 03e1368 commit add090a

File tree

5 files changed

+15
-1
lines changed

5 files changed

+15
-1
lines changed

src/features/Apiexplorer/LoginDialog/__tests__/LoginDialog.test.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import LoginDialog from '..';
33
import userEvent from '@testing-library/user-event';
44
import { screen, render } from '@testing-library/react';
55

6+
jest.mock('@docusaurus/router', () => ({
7+
useLocation: jest.fn(),
8+
}));
9+
610
describe('LoginDialog', () => {
711
test('if sign up button is clickable', async () => {
812
location.assign = jest.fn();

src/features/Apiexplorer/SubscribeRenderer/__tests__/SubscribeRenderer.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import { IPlaygroundContext } from '@site/src/contexts/playground/playground.con
1111
import { TSocketEndpointNames } from '@site/src/configs/websocket/types';
1212

1313
jest.mock('@site/src/hooks/useScrollTo');
14-
14+
jest.mock('@docusaurus/router', () => ({
15+
useLocation: jest.fn(),
16+
}));
1517
jest.mock('@site/src/hooks/useAuthContext');
1618

1719
const mockUseAuthContext = useAuthContext as jest.MockedFunction<() => Partial<IAuthContext>>;

src/features/dashboard/__tests__/AppManager.test.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { AppManager } from '..';
77
import { useTable } from 'react-table';
88

99
jest.mock('@site/src/hooks/useAuthContext');
10+
jest.mock('@docusaurus/router', () => ({
11+
useLocation: jest.fn(),
12+
}));
1013

1114
const mockUseAuthContext = useAuthContext as jest.MockedFunction<
1215
() => Partial<ReturnType<typeof useAuthContext>>

src/hooks/useLoginUrl/__tests__/useLoginUrl.test.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ jest
77
.spyOn(utils, 'getServerConfig')
88
.mockReturnValue({ appId: '1234', serverUrl: 'test.binary.sx', oauth: 'test.oauth.sx' });
99

10+
jest.mock('@docusaurus/router', () => ({
11+
useLocation: jest.fn(),
12+
}));
13+
1014
describe('Use Login URL', () => {
1115
afterEach(() => {
1216
jest.clearAllMocks();

src/hooks/useLoginUrl/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const useLoginUrl = () => {
1212

1313
return generateLoginUrl(language, oauth, appId, route);
1414
},
15+
// eslint-disable-next-line react-hooks/exhaustive-deps
1516
[location],
1617
);
1718

0 commit comments

Comments
 (0)