24 lines
345 B
JavaScript
24 lines
345 B
JavaScript
|
jest.mock('store', () => {
|
||
|
let state = {}
|
||
|
|
||
|
const mockUseStore = (selectorFn) => {
|
||
|
return selectorFn(state)
|
||
|
}
|
||
|
|
||
|
mockUseStore.setState = (newState) => {
|
||
|
state = {
|
||
|
...state,
|
||
|
...newState,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
mockUseStore.clearState = () => {
|
||
|
state = {}
|
||
|
}
|
||
|
|
||
|
return {
|
||
|
__esModule: true,
|
||
|
default: mockUseStore,
|
||
|
}
|
||
|
})
|