Reputation: 620
I have a Redux saga I am trying to test with redux-saga-test-plan. The saga SomeActions.someAction
calls ToastActions.showToast
and I am trying to assert on that call. However, it is not matching the output correctly.
I don't really care about the payload being passed to showToast
, I only care that a toast is being shown.
How do I assert on this?
Thank you!
The test:
test("...", () => {
return expectSaga(knockSaga)
.withState(...)
.provide(...)
.put.actionType(ToastActions.showToast)
.dispatch(SomeActions.someAction(...))
.run();
});
The error:
SagaTestError:
put expectation unmet:
Expected
--------
{
action: {
type: [Function: actionCreator] {
toString: [Function (anonymous)],
type: 'toast/showToast',
match: [Function (anonymous)]
}
}
}
Actual:
------
1. {
'@@redux-saga/IO': true,
combinator: false,
type: 'PUT',
payload: {
channel: undefined,
action: {
type: 'toast/showToast',
payload: {
...
}
}
}
}
Upvotes: 1
Views: 254