1 | // Type definitions for Redux Mock Store 1.0.2
|
2 | // Project: https://github.com/dmitry-zaets/redux-mock-store
|
3 | // Definitions by: Marian Palkus <https://github.com/MarianPalkus>, Cap3 <http://www.cap3.de>
|
4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
5 | // TypeScript Version: 2.3
|
6 |
|
7 | import * as Redux from 'redux';
|
8 |
|
9 | export interface MockStore<S = any, A extends Redux.Action = Redux.AnyAction> extends Redux.Store<S, A> {
|
10 | getActions(): any[];
|
11 | clearActions(): void;
|
12 | }
|
13 |
|
14 | export type MockStoreEnhanced<S = {}, DispatchExts = {}> = MockStore<S> & {dispatch: DispatchExts};
|
15 |
|
16 | export type MockStoreCreator<S = {}, DispatchExts = {}> = (state?: S | MockGetState<S>) => MockStoreEnhanced<S, DispatchExts>;
|
17 |
|
18 | export type MockGetState<S = {}> = (actions: Redux.AnyAction[]) => S;
|
19 |
|
20 | /**
|
21 | * Create Mock Store returns a function that will create a mock store from a state
|
22 | * with the same set of set of middleware applied.
|
23 | *
|
24 | * @param middlewares The list of middleware to be applied.
|
25 | * @template S The type of state to be held by the store.
|
26 | * @template DispatchExts The additional Dispatch signatures for the middlewares applied.
|
27 | */
|
28 | declare function createMockStore<S, DispatchExts = {}>(middlewares?: Redux.Middleware[]): MockStoreCreator<S, DispatchExts>;
|
29 |
|
30 | export default createMockStore;
|