You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// useStoreContext as jest.Mock<useStoreContext>.mockImplementaton(() => [state, dispatch])
15
18
19
+
constcustomTabs={
20
+
87: {
21
+
snapshots: [1,2,3,4],
22
+
hierarchy: {
23
+
index: 0,
24
+
name: 1,
25
+
branch: 0,
26
+
stateSnapshot: {
27
+
state: {},
28
+
children: [
29
+
{
30
+
state: {test: 'test'},
31
+
name: 'App',
32
+
componentData: {actualDuration: 3.5},
33
+
},
34
+
],
35
+
route: {
36
+
id: 1,
37
+
url: 'http://localhost:8080/',
38
+
},
39
+
},
40
+
children: [
41
+
{
42
+
index: 1,
43
+
name: 2,
44
+
branch: 0,
45
+
stateSnapshot: {
46
+
state: {},
47
+
children: [
48
+
{
49
+
state: {test: 'test'},
50
+
name: 'App',
51
+
componentData: {actualDuration: 3.5},
52
+
},
53
+
],
54
+
route: {
55
+
id: 2,
56
+
url: 'http://localhost:8080/',
57
+
},
58
+
},
59
+
children: [
60
+
{
61
+
index: 2,
62
+
name: 3,
63
+
branch: 0,
64
+
stateSnapshot: {
65
+
state: {},
66
+
children: [
67
+
{
68
+
state: {test: 'test'},
69
+
name: 'App',
70
+
componentData: {actualDuration: 3.5},
71
+
},
72
+
],
73
+
route: {
74
+
id: 3,
75
+
url: 'http://localhost:8080/',
76
+
},
77
+
},
78
+
children: [
79
+
{
80
+
index: 3,
81
+
name: 4,
82
+
branch: 0,
83
+
stateSnapshot: {
84
+
state: {},
85
+
children: [
86
+
{
87
+
state: {test: 'test'},
88
+
name: 'App',
89
+
componentData: {actualDuration: 3.5},
90
+
},
91
+
],
92
+
route: {
93
+
id: 4,
94
+
url: 'http://localhost:8080/test/',
95
+
},
96
+
},
97
+
children: [],
98
+
},
99
+
],
100
+
},
101
+
],
102
+
},
103
+
],
104
+
},
105
+
currLocation: {
106
+
index: 0,
107
+
name: 1,
108
+
branch: 0,
109
+
},
110
+
sliderIndex: 0,
111
+
viewIndex: -1,
112
+
},
113
+
}
114
+
115
+
constcustomInitialState={
116
+
main: {
117
+
port: null,
118
+
currentTab: 87,// Update with your desired value
119
+
currentTitle: null,
120
+
tabs: customTabs,// Replace with the actual (testing) tab data
121
+
currentTabInApp: null,
122
+
connectionStatus: false,
123
+
connectRequested: true,
124
+
},
125
+
};
126
+
127
+
constcustomStore=configureStore({
128
+
reducer: {
129
+
main: mainSlice.reducer,
130
+
},
131
+
preloadedState: customInitialState,// Provide custom initial state
132
+
middleware: (getDefaultMiddleware)=>
133
+
getDefaultMiddleware({serializableCheck: false}),
134
+
});
135
+
136
+
constrender=component=>rtlRender(
137
+
<Providerstore={customStore}>
138
+
{component}
139
+
</Provider>
140
+
);
141
+
142
+
jest.mock('react-redux',()=>({
143
+
...jest.requireActual('react-redux'),// Use the actual react-redux module except for the functions you want to mock
144
+
useDispatch: jest.fn(),// set up a mock function for useDispatch
145
+
}));
146
+
147
+
//these are needed for the Clicking pause-button toggles locked/unlocked test, as the onClick triggers the exportHandler, which uses the .creatObjectURL and .revokeObjectURL methods, so we declare them as jest functions here
0 commit comments