Skip to content
Snippets Groups Projects
Commit de939b81 authored by Tadeusz Miesiąc's avatar Tadeusz Miesiąc
Browse files

feat(utils for creating store for tests): created utility function to create store using reducer

parent 1aaf610b
No related branches found
No related tags found
2 merge requests!223reset the pin numbers before search results are fetch (so the results will be...,!20Resolve MIN-57 "Feature/ connect drug search query"
import { AnyAction, Reducer, ThunkMiddleware, configureStore } from '@reduxjs/toolkit';
import { ToolkitStore } from '@reduxjs/toolkit/dist/configureStore';
export type ToolkitStoreWithSingleSlice<StateType> = ToolkitStore<
{ [name: string]: StateType },
AnyAction,
[
ThunkMiddleware<
{
[name: string]: StateType;
},
AnyAction
>,
]
>;
export type CreateStoreInstanceUsingSliceReducer = <StateType>(
name: string,
passedReducer: Reducer<StateType>,
) => ToolkitStoreWithSingleSlice<StateType>;
export const createStoreInstanceUsingSliceReducer: CreateStoreInstanceUsingSliceReducer = (
name,
passedReducer,
) =>
configureStore({
reducer: {
[name]: passedReducer,
},
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment