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.

error in the following test:

assert.deepEqual( gen.next().value, call(delay, 1000), 'incrementAsync Saga must call delay(1000)' )

this gen.next().value return a promise as value:

{ value: Promise { _c: [], _a: undefined, _s: 0, _d: false, _v: undefined, _h: 0, _n: false, '@@redux-saga/cancelPromise': [Function] }, done: false }

So the test fail

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

20reactions
rodolfoagcommented, Apr 30, 2017

For newcomers: I was getting the same error and the problem was on the first line of incrementAsync(): yield call(delay(1000)) should be yield call(delay, 1000)

3reactions
ropinheirocommented, Jul 8, 2020

Meanwhile, I found this answer in StackOverflow:

https://stackoverflow.com/questions/49263089/how-to-test-redux-saga-delay

More specifically:

image

I suspected that something like that would be happening.

I fixed my problem by using this in both files (sagas.js and sagas.spec.js):

import { delay } from 'redux-saga'

instead of this:

const delay = ms => new Promise(res => setTimeout(res, ms))

I think the tutorial should be changed for this, too, as it not only fixes the issue, but also applies a bit of DRY philosophy to the code (not to mention the DRTW).

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Six Types of Test-Taking Errors
The Six Types of Test-Taking Errors · Misread direction errors - these errors occur when you skip directions or misunderstand directions but answer...
Read more >
Type I and type II errors - Wikipedia
In statistical hypothesis testing, a type I error is the mistaken rejection of an actually true null hypothesis (also known as a "false...
Read more >
Software Testing Errors to look out for (with examples)
In this article, we discuss some common software testing errors that a tester should be aware of. These errors are explained with examples...
Read more >
Error checking test - 123Test
Free Error checking test online. Get explanations of the right answers to all questions. Practice Error checking for upcoming iq tests.
Read more >
Types of Errors in Hypothesis Testing - Statistics By Jim
In this blog post, you will learn about the two types of errors in hypothesis testing, their causes, and how to manage them....
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