Write tests for event-driven code
Verify that events are emitted with correct payloads and received in the right order. Uses fake timers to control async timing and make tests deterministic.
Preview
Copy prompt
Write tests for the following event-driven [Language] code: [Paste code]. Verify that each event is emitted with the exact expected payload, that multiple subscribers receive events in the correct order, and that error events are surfaced and handled correctly rather than silently dropped. Use fake or controllable timers to make asynchronous event timing deterministic in the test environment.
More
Testing
Prompts
