Open cologneto opened 3 years ago
You can mock call(rest.getCustomerById, id)
.
Heres the test code I would write. (Not tested).
import {expectSaga} from 'redux-saga-test-plan';
import {call} from 'redux-saga-test-plan/matchers';
test('fetchCustomerById', () =>
expectSaga(fetchSaga)
.provide([[call.fn(rest.getCustomerById), true]])
.put(fetchCustomerSuccess(expectedCustomer)
.dispatch(action.fetchCustomerById())
.silentRun());
In the test, reset.getcustomerById would return true. Read more about static providers on document
I want to test the following saga:
I'm trying this:
And the test doesn't pass. Got this error: Assertion 2 failed: put effects do not match
Is there a way to pass undefined payload?
Thanks, Georgi