This commit is contained in:
Nathan Bierema 2021-06-16 11:39:25 -04:00
parent 96c2fd9988
commit f8685c57e0

View File

@ -3,6 +3,9 @@ import { compose, createStore } from 'redux';
describe('persistState', () => {
const savedLocalStorage = global.localStorage;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete global.localStorage;
beforeEach(() => {
global.localStorage = {
@ -118,9 +121,9 @@ describe('persistState', () => {
const spy = jest.spyOn(console, 'warn').mockImplementation(() => {
// noop
});
global.localStorage.getItem = () => {
throw new Error();
};
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete global.localStorage.getItem;
createStore(reducer, compose(instrument(), persistState('id')));
expect(spy.mock.calls[0]).toContain(
@ -134,9 +137,9 @@ describe('persistState', () => {
const spy = jest.spyOn(console, 'warn').mockImplementation(() => {
// noop
});
global.localStorage.setItem = () => {
throw new Error();
};
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete global.localStorage.setItem;
const store = createStore(
reducer,
compose(instrument(), persistState('id'))