question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unit testing error: Assertion 1 failed: call effects do not match (Even though the expected and actual result are the same)

See original GitHub issue

Hi 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:open
  • Created 4 years ago
  • Reactions:7
  • Comments:6

github_iconTop GitHub Comments

1reaction
klingenmcommented, Nov 20, 2019

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.

0reactions
TheSethnesscommented, Jun 2, 2022

@bodazhao how did you expand the log here? I’ve tried --expand and --debug and other things.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found