I have a generator that I want to cover with unit-test
export default function* gatawayFlow() {
yield all([
takeEvery(actionTypes.GET_GATEWAYS_REQUEST, getGatewaysFlow),
takeLatest(actionTypes.SELECT_GATEWAY_REQUEST, selectGatewayFlow),
]);
}
I wrote a simple test with redux-sag-test-plan
import {expectSaga, testSaga} from 'redux-saga-test-plan';
import gatawayFlow, {getGatewaysFlow, selectGatewayFlow} from '../logic/sagas';
import * as actions from '../logic/actions';
import * as actionTypes from '../logic/actionTypes';
import {takeEvery, takeLatest} from '@redux-saga/core/effects';
// Unit-test
describe('Unit tests', () => {
test('Test all effect', () => {
const saga = testSaga(gatawayFlow);
saga
.next()
.all({
[actionTypes.GET_GATEWAYS_REQUEST]: takeEvery(actionTypes.GET_GATEWAYS_REQUEST, getGatewaysFlow),
[actionTypes.SELECT_GATEWAY_REQUEST]: takeLatest(actionTypes.SELECT_GATEWAY_REQUEST, selectGatewayFlow)
})
.next()
.isDone();
// expect(gatawayFlow().next().value).toEqual(all([
// takeEvery(actionTypes.GET_GATEWAYS_REQUEST, getGatewaysFlow),
// takeEvery(actionTypes.SELECT_GATEWAY_REQUEST, selectGatewayFlow),
// ])); ---> THIS TEST WORKS CORRECT
});
});
And my test didn't pass. I have this error in my terminal. Any ideas how I can solve it?