From d3e8df0c826b73b91756bdfb60fa3c22e1fc0771 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Mon, 5 Aug 2024 22:58:55 -0400 Subject: [PATCH] Updates --- packages/redux-devtools-app-core/test/app.spec.tsx | 9 +++++++-- .../redux-devtools-instrument/test/instrument.spec.ts | 9 ++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/redux-devtools-app-core/test/app.spec.tsx b/packages/redux-devtools-app-core/test/app.spec.tsx index 6c881c3f..8949c6e0 100644 --- a/packages/redux-devtools-app-core/test/app.spec.tsx +++ b/packages/redux-devtools-app-core/test/app.spec.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { Provider } from 'react-redux'; -import { createStore, applyMiddleware } from 'redux'; +import { createStore, applyMiddleware, Reducer } from 'redux'; import { render, screen, within } from '@testing-library/react'; import App from '../src/containers/App'; import { exportStateMiddleware } from '../src/middlewares/exportState'; @@ -8,6 +8,7 @@ import { coreReducers } from '../src/reducers'; import { DATA_TYPE_KEY } from '../src/constants/dataTypes'; import { stringifyJSON } from '../src/utils/stringifyJSON'; import { combineReducers } from 'redux'; +import { CoreStoreAction, CoreStoreState } from '../lib/types'; Object.defineProperty(window, 'matchMedia', { writable: true, @@ -24,7 +25,11 @@ Object.defineProperty(window, 'matchMedia', { }); const store = createStore( - combineReducers(coreReducers), + combineReducers(coreReducers) as Reducer< + CoreStoreState, + CoreStoreAction, + Partial + >, applyMiddleware(exportStateMiddleware), ); diff --git a/packages/redux-devtools-instrument/test/instrument.spec.ts b/packages/redux-devtools-instrument/test/instrument.spec.ts index f2fe43c3..cee399a6 100644 --- a/packages/redux-devtools-instrument/test/instrument.spec.ts +++ b/packages/redux-devtools-instrument/test/instrument.spec.ts @@ -1382,7 +1382,9 @@ describe('instrument', () => { it('throws if reducer is not a function', () => { expect(() => createStore(undefined as unknown as Reducer, instrument()), - ).toThrow('Expected the reducer to be a function.'); + ).toThrow( + "Expected the root reducer to be a function. Instead, received: 'undefined'", + ); }); it('warns if the reducer is not a function but has a default field that is', () => { @@ -1396,10 +1398,7 @@ describe('instrument', () => { instrument(), ), ).toThrow( - 'Expected the reducer to be a function. ' + - 'Instead got an object with a "default" field. ' + - 'Did you pass a module instead of the default export? ' + - 'Try passing require(...).default instead.', + "Expected the root reducer to be a function. Instead, received: 'object'", ); });