I've written a few tape tests for my sagas but the most simple examples are consistently failing for the same reason. I have a one line saga:
export function* clearUser(){
yield* put({type: 'CLEAR_USER'});
}
my tape test is equally simple:
test('clear user saga', (assert)=> {
const gen = clearUser();
assert.deepEqual(
gen.next().value,
put({type: 'CLEAR_USER'}),
'clear user should pass to reducer to remove user from state'
)
assert.deepEqual(
gen.next(),
{ done: true, value: undefined },
'clear user saga should complete'
)
assert.end()
});
However, the first assertion fails and says the value is undefined:
operator: deepEqual
expected: |-
{ '@@redux-saga/IO': true, PUT: { action: { type: 'CLEAR_USER' }, channel: null } }
actual: |-
undefined
I've confirmed I'm importing the saga, and other tests are working, why does this simple test fail?
Aucun commentaire:
Enregistrer un commentaire