Unit testing error: Assertion 1 failed: call effects do not match (Even though the expected and actual result are the same)
See original GitHub issueHi I’m having this weird issue, that when I’m passing the call action in an unit test I’m receiving this error, test was working before, but I add to that saga a CancelToken for cancelling the request.
Expected
--------
{ '@@redux-saga/IO': true,
combinator: false,
type: 'CALL',
payload:
{ context: null,
fn: [Function: getVisualizations],
args: [ '1', { token: [Object], cancel: [Function: cancel] } ] } }
Actual
------
{ '@@redux-saga/IO': true,
combinator: false,
type: 'CALL',
payload:
{ context: null,
fn: [Function: getVisualizations],
args: [ '1', { token: [Object], cancel: [Function: cancel] } ] } }
As you can see, I believe they’re exactly the same outputs, but they don’t match. This is the failing test:
describe("Unit testing", () => {
let saga = testSaga(getVisualizationSaga, action);
const cancel = CancelToken.source();
it("fetches visualizations", () => {
saga
.next()
.call(getVisualizations, action.payload, cancel)
.next()
.put(fetchVisualizationsSucceed())
.next()
.isDone();
});
});
});
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:6
Top Results From Across the Web
redux-saga-test-plan put effects do not match, but payload of ...
The onSuccess and onFailed methods have different references in saga and test cases. The assertions will definitely fail.
Read more >Error Messages · GitBook - Redux Saga Test Plan
Error Messages. If a yielded effect and assertion effect call don't match, then the mock saga will throw an error showing the difference...
Read more >unittest — Unit testing framework — Python 3.11.1 ...
It checks for a specific response to a particular set of inputs. unittest provides a base class, TestCase , which may be used...
Read more >Testing Sagas - Redux-Saga
There are two main ways to test Sagas: testing the saga generator function step-by-step or running the full saga and asserting the side...
Read more >Expect / Should - Chai Assertion Library
Just because you can negate any assertion with .not doesn't mean you should. With great power comes great responsibility. It's often best to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi! I’m having the same issue.
Seems there code that generates the output only goes so deep, probably standard toString or something.
There might be differences hiding for you underneath the token or cancel keys.
@bodazhao how did you expand the log here? I’ve tried --expand and --debug and other things.