我是一家sagas.factory,想要对其进行测试,但是我遇到了一些问题...
我创造了类似的萨加斯
export const tasksFetchRequestSagaFactory = ({service}) => {
return function* () {
const request = yield put(service())
console.log(request)
yield put(tasksFetchSuccess(request))
}
}
我有考试
const gen = tasksFetchRequestSagaFactory(tasksFetchService({service: tasksFetchService}))
it('should be called correctly', () => {
expect(gen.next().value).toEqual(put(tasksFetchService()))
})
但是当尝试运行测试时,出现一些错误
TypeError: Cannot destructure property `service` of 'undefined' or 'null'.
2 | import { tasksFetchSuccess } from './tasks.actions'
3 |
> 4 | export const tasksFetchRequestSagaFactory = ({service}) => {
| ^
5 | return function* () {
6 | const request = yield put(service())
7 | console.log(request)