Chai assertions for redux-saga (WIP) Completion status
redux-saga-chai
extends Chai and allows you to be more verbose while testing sagas
npm i r1zzu/redux-saga-chai --save-dev
const chai = require('chai');
const reduxSagaChai = require('redux-saga-chai');
chai.use(reduxSagaChai);
You can find complete docs here
function* testSaga() {
yield take('ACTION')
yield call(delay, 300);
yield put({ type: 'ANOTHER_ACTION' });
}
describe('testSaga', () => {
const gen = testSaga();
let next;
beforeEach(() => {
next = gen.next();
});
it('should take ACTTION', () => {
expect(next).to.take('ACTION');
});
it('should wait 300ms', () => {
expect(next).to.wait(300);
})
it('should put ANOTHER_ACTION', () => {
expect(next).to.put({ type: 'ANOTHER_ACTION' });
});
})