Skip to content
WebMCP Agents
Esc
↑↓navigate↵open⌘Jpreview
On this page

toHaveEventOrder

These event types happened in this order, others allowed between them.

Passes when the listed event types happened in this order. Other events may come between (several fills, a yield): the list is checked as a subsequence.

Import

import "@webmcp-agents/testing/matchers"; // in setupFiles (the main entry and ./setup register them too)

Example

expect(events).toHaveEventOrder(["start", "fill", "park", "result"]);

Options

expect(received).toHaveEventOrder(order).

Name Type Default Description
order string[] required Event types: start, fill, park, result, error, cancel, yield, resume.

Returns

Nothing: it passes, or fails the test with a message that says what happened.

Notes

A failure prints both orders and the step where they part:

Expected, in order:  start → result → park
Happened:           start → fill → fill → park → yield → result

See also

Was this page helpful?