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
This commit is contained in:
Robert Pethick
2019-04-30 18:17:48 +01:00
committed by Wesley Wigham
parent db485fd27b
commit af02c4bcb1

View File

@@ -13,7 +13,9 @@ export interface MockStore<S = any, A extends Redux.Action = Redux.AnyAction> ex
export type MockStoreEnhanced<S = {}, DispatchExts = {}> = MockStore<S> & {dispatch: DispatchExts};
export type MockStoreCreator<S = {}, DispatchExts = {}> = (state?: S) => MockStoreEnhanced<S, DispatchExts>;
export type MockStoreCreator<S = {}, DispatchExts = {}> = (state?: S | MockGetState<S>) => MockStoreEnhanced<S, DispatchExts>;
export type MockGetState<S = {}> = (actions: Redux.AnyAction[]) => S;
/**
* Create Mock Store returns a function that will create a mock store from a state