# Testing Edge Cases, Errors and Async Code

Bugs hide at the limits, in the errors and in the code that waits, so this lesson tests all three with Vitest, using toThrow, resolves and rejects, and fake timers that skip ahead in time.

![Cheat sheet: Testing Edge Cases, Errors and Async Code](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/10/fb59625bbb2449cb99f7c123233c5330.webp)

- Category: JavaScript
- Level: Freelancer
- Tags: Edge Case, Fake Timers, JavaScript, Promise, Test Case, Test Double, unit testing
- Updated: November 1, 2026

Source: https://www.ask-codey.com/cheat-sheets/javascript-testing-edge-cases-errors-async-cheat-sheet
