@@ -2,7 +2,7 @@ import { AxiosError } from 'axios'
2
2
import { cloneDeep } from 'lodash'
3
3
import { apiService } from 'uiSrc/services'
4
4
import { addErrorNotification } from 'uiSrc/slices/app/notifications'
5
- import { initialStateDefault , mockedStore } from 'uiSrc/utils/test-utils'
5
+ import { cleanup , initialStateDefault , mockedStore } from 'uiSrc/utils/test-utils'
6
6
import reducer , {
7
7
initialState ,
8
8
loadClientCerts ,
@@ -20,6 +20,13 @@ jest.mock('uiSrc/services', () => ({
20
20
...jest . requireActual ( 'uiSrc/services' ) ,
21
21
} ) )
22
22
23
+ let store : typeof mockedStore
24
+ beforeEach ( ( ) => {
25
+ cleanup ( )
26
+ store = cloneDeep ( mockedStore )
27
+ store . clearActions ( )
28
+ } )
29
+
23
30
describe ( 'clientCerts slice' , ( ) => {
24
31
describe ( 'reducer, actions and selectors' , ( ) => {
25
32
it ( 'should return the initial state on first run' , ( ) => {
@@ -201,7 +208,6 @@ describe('clientCerts slice', () => {
201
208
const responsePayload = { data, status : 200 }
202
209
203
210
apiService . get = jest . fn ( ) . mockResolvedValue ( responsePayload )
204
- const store = cloneDeep ( mockedStore )
205
211
206
212
// Act
207
213
await store . dispatch < any > ( fetchClientCerts ( ) )
@@ -231,8 +237,6 @@ describe('clientCerts slice', () => {
231
237
232
238
const id = '70b95d32-c19d-4311-bb24-e684af12cf15'
233
239
234
- const store = cloneDeep ( mockedStore )
235
-
236
240
// Act
237
241
await store . dispatch < any > ( deleteClientCertAction ( id , onSuccessAction ) )
238
242
@@ -259,8 +263,6 @@ describe('clientCerts slice', () => {
259
263
const onSuccessAction = jest . fn ( )
260
264
const id = '70b95d32-c19d-4311-bb24-e684af12cf15'
261
265
262
- const store = cloneDeep ( mockedStore )
263
-
264
266
// Act
265
267
await store . dispatch < any > ( deleteClientCertAction ( id , onSuccessAction ) )
266
268
0 commit comments