kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Clear React Query cache before each test
rodzic
b2530dadd5
commit
968ec3a7d2
|
@ -37,6 +37,8 @@ const queryClient = new QueryClient({
|
||||||
},
|
},
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
queries: {
|
queries: {
|
||||||
|
staleTime: 0,
|
||||||
|
cacheTime: Infinity,
|
||||||
retry: false,
|
retry: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -123,4 +125,5 @@ export {
|
||||||
rootReducer,
|
rootReducer,
|
||||||
mockWindowProperty,
|
mockWindowProperty,
|
||||||
createTestStore,
|
createTestStore,
|
||||||
|
queryClient,
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,9 +2,14 @@
|
||||||
|
|
||||||
import { __clear as clearApiMocks } from '../__mocks__/api';
|
import { __clear as clearApiMocks } from '../__mocks__/api';
|
||||||
|
|
||||||
|
import { queryClient } from './test-helpers';
|
||||||
|
|
||||||
// API mocking
|
// API mocking
|
||||||
jest.mock('soapbox/api');
|
jest.mock('soapbox/api');
|
||||||
afterEach(() => clearApiMocks());
|
afterEach(() => {
|
||||||
|
clearApiMocks();
|
||||||
|
queryClient.clear();
|
||||||
|
});
|
||||||
|
|
||||||
// Mock IndexedDB
|
// Mock IndexedDB
|
||||||
// https://dev.to/andyhaskell/testing-your-indexeddb-code-with-jest-2o17
|
// https://dev.to/andyhaskell/testing-your-indexeddb-code-with-jest-2o17
|
||||||
|
|
Ładowanie…
Reference in New Issue