Skip to content

async code refactor#1

Open
rjoydip-zz wants to merge 5 commits into
academind:masterfrom
rjoydip-zz:async-code-patch-1
Open

async code refactor#1
rjoydip-zz wants to merge 5 commits into
academind:masterfrom
rjoydip-zz:async-code-patch-1

Conversation

@rjoydip-zz
Copy link
Copy Markdown

Added expect.assertions(1) and return promise from test case.

Below notes taken from "Jest docs"

expect.assertions(number) verifies that a certain number of assertions are called during a test. This is often useful when testing asynchronous code, in order to make sure that assertions in a callback actually got called.```

If your code uses promises, there is a simpler way to handle asynchronous tests. Just return a promise from your test, and Jest will wait for that promise to resolve. If the promise is rejected, the test will automatically fail.```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants