【发布时间】:2021-11-05 19:14:53
【问题描述】:
在我想要测试的代码中,有 store.subscribe() 函数,但我不知道如何测试它。
test('should call console.log inside subscribe fn', async () => {
const store = configureStore(initialState);
store.subscribe(() => console.log(store.getState())); // console.log was not called
await wait(100);
})
在我的代码中
// index.ts
export const store = createStore();
store.subscribe(() => console.log(store.getState())); // how can i test it in jest?
【问题讨论】:
标签: javascript unit-testing redux jestjs