Skip to content

expectRecorded

function expectRecorded<A>(core, matcher): Promise<AuditEvent>;

Defined in: src/testing.ts:246

Assert that core recorded an event matching matcher (deep subset). Resolves to the newest matching event; throws a descriptive Error (listing what was recorded instead) otherwise. Works with any test runner.

Type Parameter
A extends ActionMap
Parameter Type
core AuditCore<A>
matcher RecordedMatcher

Promise<AuditEvent>

const event = await expectRecorded(core, {
tenant: "acme",
action: "member.role_changed",
targets: [{ type: "user", id: "u2" }],
metadata: { to: "admin" },
});