More fixes

This commit is contained in:
Nathan Bierema 2021-06-16 11:25:45 -04:00
parent 6790090b90
commit 96c2fd9988
2 changed files with 10 additions and 3 deletions

View File

@ -1141,6 +1141,8 @@ describe('instrument', () => {
const importMonitoredLiftedStore = importMonitoredStore.liftedStore; const importMonitoredLiftedStore = importMonitoredStore.liftedStore;
const noComputedExportedState = Object.assign({}, exportedState); const noComputedExportedState = Object.assign({}, exportedState);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete noComputedExportedState.computedStates; delete noComputedExportedState.computedStates;
importMonitoredLiftedStore.dispatch( importMonitoredLiftedStore.dispatch(
@ -1184,6 +1186,8 @@ describe('instrument', () => {
state: LiftedState<S, A, null> state: LiftedState<S, A, null>
) { ) {
state.actionsById = _.mapValues(state.actionsById, (action) => { state.actionsById = _.mapValues(state.actionsById, (action) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
delete action.timestamp; delete action.timestamp;
delete action.stack; delete action.stack;
return action; return action;

View File

@ -3,7 +3,6 @@ import { compose, createStore } from 'redux';
describe('persistState', () => { describe('persistState', () => {
const savedLocalStorage = global.localStorage; const savedLocalStorage = global.localStorage;
delete global.localStorage;
beforeEach(() => { beforeEach(() => {
global.localStorage = { global.localStorage = {
@ -119,7 +118,9 @@ describe('persistState', () => {
const spy = jest.spyOn(console, 'warn').mockImplementation(() => { const spy = jest.spyOn(console, 'warn').mockImplementation(() => {
// noop // noop
}); });
delete global.localStorage.getItem; global.localStorage.getItem = () => {
throw new Error();
};
createStore(reducer, compose(instrument(), persistState('id'))); createStore(reducer, compose(instrument(), persistState('id')));
expect(spy.mock.calls[0]).toContain( expect(spy.mock.calls[0]).toContain(
@ -133,7 +134,9 @@ describe('persistState', () => {
const spy = jest.spyOn(console, 'warn').mockImplementation(() => { const spy = jest.spyOn(console, 'warn').mockImplementation(() => {
// noop // noop
}); });
delete global.localStorage.setItem; global.localStorage.setItem = () => {
throw new Error();
};
const store = createStore( const store = createStore(
reducer, reducer,
compose(instrument(), persistState('id')) compose(instrument(), persistState('id'))