Open cjones26 opened 5 years ago
Hi, I'm having an issue attempting to test one of my "root" sagas which looks like so:
export function* rootSaga() { yield all([ activeRootSaga(), inactiveRootSaga(), takeLatest(DELETE_ONBOARD, deleteOnboardSaga), takeLatest(ADD_ONBOARD, addOnboardSaga) ]); }
I am able to properly test this saga without utilizing redux-saga-test-plan like so:
describe('rootSaga tests', () => { it('should trigger all action listeners', () => { const iterator = rootSaga(); const expectedYield = all([ activeRootSaga(), inactiveRootSaga(), takeLatest(DELETE_ONBOARD, deleteOnboardSaga), takeLatest(ADD_ONBOARD, addOnboardSaga) ]); expect(iterator.next().value).toEqual(expectedYield); }); });
Unfortunately, when attempting to test the saga utilizing redux-saga-test-plan, like so:
describe('rootSaga tests', () => { it('should trigger all action listeners', () => { testSaga(rootSaga) .next() .all([ activeRootSaga(), inactiveRootSaga(), takeLatest(DELETE_ONBOARD, deleteOnboardSaga), takeLatest(ADD_ONBOARD, addOnboardSaga) ]) .next() .isDone(); }); });
I receive the following error:
● onboardSagas tests › rootSaga tests › should trigger all action listeners SagaTestError: Assertion 1 failed: all effects do not match Expected -------- [ {}, {}, { '@@redux-saga/IO': true, FORK: { context: null, fn: [Function: takeLatest], args: [ 'ruleManagement/DELETE_ONBOARD', [Function: deleteOnboardSaga] ] } }, { '@@redux-saga/IO': true, FORK: { context: null, fn: [Function: takeLatest], args: [ 'ruleManagement/ADD_ONBOARD', [Function: addOnboardSaga] ] } } ] Actual ------ [ {}, {}, { '@@redux-saga/IO': true, FORK: { context: null, fn: [Function: takeLatest], args: [ 'ruleManagement/DELETE_ONBOARD', [Function: deleteOnboardSaga] ] } }, { '@@redux-saga/IO': true, FORK: { context: null, fn: [Function: takeLatest], args: [ 'ruleManagement/ADD_ONBOARD', [Function: addOnboardSaga] ] } } ] 56 | testSaga(rootSaga) 57 | .next() > 58 | .all([ | ^ 59 | activeRootSaga(), 60 | inactiveRootSaga(), 61 | takeLatest(DELETE_ONBOARD, deleteOnboardSaga), at new SagaTestError (node_modules/redux-saga-test-plan/lib/shared/SagaTestError.js:17:57) at assertSameEffect (node_modules/redux-saga-test-plan/lib/testSaga/assertSameEffect.js:20:11) at Object.all (node_modules/redux-saga-test-plan/lib/testSaga/index.js:71:40) at Object.all (src/state-management/modules/ruleManagement/__tests__/onboardSagas.test.js:58:10)
● onboardSagas tests › rootSaga tests › should trigger all action listeners
SagaTestError: Assertion 1 failed: all effects do not match Expected -------- [ {}, {}, { '@@redux-saga/IO': true, FORK: { context: null, fn: [Function: takeLatest], args: [ 'ruleManagement/DELETE_ONBOARD', [Function: deleteOnboardSaga] ] } }, { '@@redux-saga/IO': true, FORK: { context: null, fn: [Function: takeLatest], args: [ 'ruleManagement/ADD_ONBOARD', [Function: addOnboardSaga] ] } } ] Actual ------ [ {}, {}, { '@@redux-saga/IO': true, FORK: { context: null, fn: [Function: takeLatest], args: [ 'ruleManagement/DELETE_ONBOARD', [Function: deleteOnboardSaga] ] } }, { '@@redux-saga/IO': true, FORK: { context: null, fn: [Function: takeLatest], args: [ 'ruleManagement/ADD_ONBOARD', [Function: addOnboardSaga] ] } } ] 56 | testSaga(rootSaga) 57 | .next() > 58 | .all([ | ^ 59 | activeRootSaga(), 60 | inactiveRootSaga(), 61 | takeLatest(DELETE_ONBOARD, deleteOnboardSaga), at new SagaTestError (node_modules/redux-saga-test-plan/lib/shared/SagaTestError.js:17:57) at assertSameEffect (node_modules/redux-saga-test-plan/lib/testSaga/assertSameEffect.js:20:11) at Object.all (node_modules/redux-saga-test-plan/lib/testSaga/index.js:71:40) at Object.all (src/state-management/modules/ruleManagement/__tests__/onboardSagas.test.js:58:10)
Same issue here
Hi, I'm having an issue attempting to test one of my "root" sagas which looks like so:
I am able to properly test this saga without utilizing redux-saga-test-plan like so:
Unfortunately, when attempting to test the saga utilizing redux-saga-test-plan, like so:
I receive the following error: