Skip to content

Commit 73495d2

Browse files
committed
Add store test util
1 parent dc02c71 commit 73495d2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/testUtils.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { addReactStore } from '../src/utils/reactStoreEnhancer'
2+
import { createStore as reduxCreateStore } from 'redux'
3+
import { configureStore } from '@reduxjs/toolkit'
4+
import type { Reducer } from 'redux'
5+
6+
export function createTestStore(reducer: Reducer, preloadedState?: any) {
7+
return reduxCreateStore(reducer, preloadedState, addReactStore)
8+
}
9+
10+
// For RTK tests
11+
export function configureTestStore(options: any) {
12+
return configureStore({
13+
...options,
14+
enhancers: (getDefault) => getDefault().concat(addReactStore),
15+
})
16+
}

0 commit comments

Comments
 (0)