From af02c4bcb195cbfd9cccab585f9785ac73d95ce1 Mon Sep 17 00:00:00 2001 From: Robert Pethick Date: Tue, 30 Apr 2019 18:17:48 +0100 Subject: [PATCH] Add method option for mocking getState method (#34988) As in the docs to the main JS library you can either supply state to the MockStoreCreator or you can pass a method in which is given the list of currently dispatched actions --- types/redux-mock-store/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/redux-mock-store/index.d.ts b/types/redux-mock-store/index.d.ts index 5966b125a8..64b914710f 100644 --- a/types/redux-mock-store/index.d.ts +++ b/types/redux-mock-store/index.d.ts @@ -13,7 +13,9 @@ export interface MockStore ex export type MockStoreEnhanced = MockStore & {dispatch: DispatchExts}; -export type MockStoreCreator = (state?: S) => MockStoreEnhanced; +export type MockStoreCreator = (state?: S | MockGetState) => MockStoreEnhanced; + +export type MockGetState = (actions: Redux.AnyAction[]) => S; /** * Create Mock Store returns a function that will create a mock store from a state