0
我已經寫了一些磁帶測試我的傳奇,但最簡單的例子始終因相同的原因失敗。我有一個行之城:簡單的磁帶js測試的REDX傳奇失敗與未定義
export function* clearUser(){
yield* put({type: 'CLEAR_USER'});
}
我帶試驗也同樣簡單:
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()
});
然而,第一個斷言失敗,並表示值爲undefined:
operator: deepEqual
expected: |-
{ '@@redux-saga/IO': true, PUT: { action: { type: 'CLEAR_USER' }, channel: null } }
actual: |-
undefined
我已經確認我正在導入傳奇,而其他測試正在運行,爲什麼這個簡單的測試失敗?