From the course: Node.js: Testing and Code Quality

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Challenge: Test async/await with Jest

Challenge: Test async/await with Jest

From the course: Node.js: Testing and Code Quality

Challenge: Test async/await with Jest

(upbeat music) - [Instructor] In this chapter we learned how to test different types of asynchronous code including callbacks and promises. How can we test async/await code with Jest? The jest.io website includes documentation on how to write asynchronous tests. First, read through the documentation specifically the async/await section. With that knowledge update the test we wrote for lib/reservations.test.js to rewrite the promises into the async/await syntax. While you're at it use the resolves and rejects matchers previously mentioned. The solution will be in the next video, good luck.

Contents