Skip to content

Commit 4fd774e

Browse files
committed
fix tests
1 parent 572feb8 commit 4fd774e

32 files changed

+747
-2027
lines changed

package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,11 @@
4848
"react-hot-keys": "2.7.3",
4949
"react-lazylog": "4.5.3",
5050
"react-linkify": "0.2.2",
51-
"react-redux": "8.0.7",
5251
"react-resizable-panels": "3.0.6",
5352
"react-router-dom": "6.28.0",
5453
"react-table-6": "6.11.0",
5554
"react-tabs": "6.1.0",
5655
"redoc": "2.4.0",
57-
"redux": "4.2.1",
58-
"redux-debounce": "1.0.1",
59-
"redux-thunk": "2.4.2",
6056
"stream-browserify": "3.0.0",
6157
"styled-components": "6.1.19",
6258
"taskcluster-client-web": "87.1.3",
@@ -106,7 +102,6 @@
106102
"markdownlint-cli": "0.43.0",
107103
"prettier": "2.2.1",
108104
"puppeteer": "24.2.1",
109-
"redux-mock-store": "1.5.5",
110105
"sass": "1.93.2",
111106
"sass-loader": "16.0.6",
112107
"setup-polly-jest": "0.11.0",

pnpm-lock.yaml

Lines changed: 0 additions & 144 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/ui/job-view/AppHistory_test.jsx

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import React from 'react';
22
import fetchMock from 'fetch-mock';
33
import { render, waitFor } from '@testing-library/react';
4-
import { Provider, ReactReduxContext } from 'react-redux';
54
import { MemoryRouter, useLocation } from 'react-router-dom';
65

76
import { AppRoutes } from '../../../ui/App';
87
import pushListFixture from '../mock/push_list';
98
import reposFixture from '../mock/repositories';
109
import { getApiUrl } from '../../../ui/helpers/url';
1110
import { getProjectUrl } from '../../../ui/helpers/location';
12-
import { configureStore } from '../../../ui/job-view/redux/configureStore';
11+
import { usePushStore } from '../../../ui/job-view/stores/pushStore';
12+
import { useSelectedJobStore } from '../../../ui/job-view/stores/selectedJobStore';
13+
import { usePinnedJobsStore } from '../../../ui/job-view/stores/pinnedJobsStore';
1314

1415
// Component to capture location for testing
1516
let testLocation;
@@ -19,14 +20,11 @@ const LocationCapture = () => {
1920
};
2021

2122
const testApp = (initialEntries) => {
22-
const store = configureStore();
2323
return (
24-
<Provider store={store} context={ReactReduxContext}>
25-
<MemoryRouter initialEntries={initialEntries}>
26-
<LocationCapture />
27-
<AppRoutes />
28-
</MemoryRouter>
29-
</Provider>
24+
<MemoryRouter initialEntries={initialEntries}>
25+
<LocationCapture />
26+
<AppRoutes />
27+
</MemoryRouter>
3028
);
3129
};
3230

@@ -75,6 +73,23 @@ describe('history', () => {
7573

7674
beforeEach(() => {
7775
testLocation = null;
76+
77+
// Reset Zustand stores
78+
usePushStore.setState({
79+
pushList: [],
80+
jobMap: {},
81+
decisionTaskMap: {},
82+
revisionTips: [],
83+
allUnclassifiedFailureCount: 0,
84+
filteredUnclassifiedFailureCount: 0,
85+
});
86+
useSelectedJobStore.setState({
87+
selectedJob: null,
88+
});
89+
usePinnedJobsStore.setState({
90+
pinnedJobs: {},
91+
isPinBoardVisible: false,
92+
});
7893
});
7994

8095
afterAll(() => {

tests/ui/job-view/AppRoutes_test.jsx

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import React from 'react';
22
import fetchMock from 'fetch-mock';
33
import { render, waitFor } from '@testing-library/react';
4-
import { Provider, ReactReduxContext } from 'react-redux';
54
import { MemoryRouter, useLocation } from 'react-router-dom';
65

76
import { AppRoutes } from '../../../ui/App';
87
import reposFixture from '../mock/repositories';
98
import { getApiUrl } from '../../../ui/helpers/url';
109
import { getProjectUrl } from '../../../ui/helpers/location';
11-
import { configureStore } from '../../../ui/job-view/redux/configureStore';
10+
import { usePushStore } from '../../../ui/job-view/stores/pushStore';
11+
import { useSelectedJobStore } from '../../../ui/job-view/stores/selectedJobStore';
12+
import { usePinnedJobsStore } from '../../../ui/job-view/stores/pinnedJobsStore';
1213

1314
// Component to capture location for testing
1415
let testLocation;
@@ -18,14 +19,11 @@ const LocationCapture = () => {
1819
};
1920

2021
const testApp = (initialEntries) => {
21-
const store = configureStore();
2222
return (
23-
<Provider store={store} context={ReactReduxContext}>
24-
<MemoryRouter initialEntries={initialEntries}>
25-
<LocationCapture />
26-
<AppRoutes />
27-
</MemoryRouter>
28-
</Provider>
23+
<MemoryRouter initialEntries={initialEntries}>
24+
<LocationCapture />
25+
<AppRoutes />
26+
</MemoryRouter>
2927
);
3028
};
3129

@@ -58,6 +56,23 @@ describe('Test for backwards-compatible routes for other apps', () => {
5856

5957
beforeEach(() => {
6058
testLocation = null;
59+
60+
// Reset Zustand stores
61+
usePushStore.setState({
62+
pushList: [],
63+
jobMap: {},
64+
decisionTaskMap: {},
65+
revisionTips: [],
66+
allUnclassifiedFailureCount: 0,
67+
filteredUnclassifiedFailureCount: 0,
68+
});
69+
useSelectedJobStore.setState({
70+
selectedJob: null,
71+
});
72+
usePinnedJobsStore.setState({
73+
pinnedJobs: {},
74+
isPinBoardVisible: false,
75+
});
6176
});
6277

6378
test('old push health url should redirect to correct url', async () => {

0 commit comments

Comments
 (0)