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.

SagaTestError: call expectation unmet:

See original GitHub issue

Hi, I am testing if a yield call has been executed. I receive this error which I probably misunderstand, but as far as I can tell the function is called with the same parameters in both the saga and the test file.

Does anyone know why the expectation is unmet?

Let me know if I need to post the saga/test suite.

` SagaTestError: call expectation unmet:

Expected
--------
{ '@@redux-saga/IO': true,
  combinator: false,
  type: 'CALL',
  payload: 
   { context: null,
     fn: 
      { [Function: mockConstructor]
        _isMockFunction: true,
        getMockImplementation: [Function],
        mock: [Getter/Setter],
        mockClear: [Function],
        mockReset: [Function],
        mockRestore: [Function],
        mockReturnValueOnce: [Function],
        mockResolvedValueOnce: [Function],
        mockRejectedValueOnce: [Function],
        mockReturnValue: [Function],
        mockResolvedValue: [Function],
        mockRejectedValue: [Function],
        mockImplementationOnce: [Function],
        mockImplementation: [Function],
        mockReturnThis: [Function],
        mockName: [Function],
        getMockName: [Function] },
     args: [ { user: [Object] } ] } }

Actual:
------
1. { '@@redux-saga/IO': true,
  combinator: false,
  type: 'CALL',
  payload: 
   { context: null,
     fn: 
      { [Function: mockConstructor]
        _isMockFunction: true,
        getMockImplementation: [Function],
        mock: [Getter/Setter],
        mockClear: [Function],
        mockReset: [Function],
        mockRestore: [Function],
        mockReturnValueOnce: [Function],
        mockResolvedValueOnce: [Function],
        mockRejectedValueOnce: [Function],
        mockReturnValue: [Function],
        mockResolvedValue: [Function],
        mockRejectedValue: [Function],
        mockImplementationOnce: [Function],
        mockImplementation: [Function],
        mockReturnThis: [Function],
        mockName: [Function],
        getMockName: [Function] },
     args: [ { user: [Object] } ] } }`

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:7

github_iconTop GitHub Comments

5reactions
maxammanncommented, Sep 10, 2019

It would be cool if the serializer could show that the arguments serialize to the same string but have a different identity.

1reaction
steffenkleinlecommented, Jun 18, 2020

As a workaround it is also possible to use the .like property which does not fail if it is not the same identity, e.g. expectSaga(foo, bar).call.like(baz, qux).run()

Can you please give a more detailed example of using .like with expectSaga?

Sure, see the docs here: https://github.com/jfairbank/redux-saga-test-plan/blob/7f78a0742f94c67a221a9a1370b65f65e38b66b6/docs/integration-testing/partial-matching.md

Read more comments on GitHub >

github_iconTop Results From Across the Web

redux saga is returning SagaTestError: put expectation unmet ...
1 Answer 1 ; import { call, takeLatest, put } from 'redux-saga/effects' ; import { api } from './api' ; import { types...
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 >
redux-saga-test-plan - Bountysource
I run test on saga, but on second call i have an error and i don't know what i need to do: SagaTestError:...
Read more >
[Solved]-API call with saga not returning user data-Reactjs
Coding example for the question API call with saga not returning user ... saga is returning SagaTestError: put expectation unmet when checking api...
Read more >
Redux Saga - Need help with testing task cancellation : r/reactjs
SagaTestError : call expectation unmet: Expected ... SagaTestError (node_modules/redux-saga-test-plan/lib/shared/SagaTestError.js:17:57) at ...
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