testing/connection_closer_helpers.ts

Declarations
#

4 declarations

view source

assert_close_call
#

testing/connection_closer_helpers.ts view source

(call: RecordedClose | undefined, method: "account" | "token" | "session", id: string): void

Pin {method, id} on a single recorded close call without baking in the at: N sequence number. Use at every "did the closer fire?" assertion site; the sequence number is only meaningful for dedicated ordering tests (paired with create_emit_ordering_audit_factory).

Throws via assert.ok if call is undefined — index a recorded calls array directly (calls[0]) and let this helper handle the missing-element case.

call

type RecordedClose | undefined

method

type "account" | "token" | "session"

id

type string

returns

void

create_recording_closer
#

testing/connection_closer_helpers.ts view source

(seq_ref?: { value: number; } | undefined): RecordingCloser

Build a ConnectionCloser that records every call into calls rather than touching real transports. Each method returns 1 ("one socket closed") regardless of whether a real socket exists — handlers typically ignore the return value.

Pass seq_ref to share the sequence counter with a sibling create_emit_ordering_audit_factory so tests can pin close-vs-emit ordering at the handler call site. Without seq_ref, the closer uses a fresh internal counter — at: N values within a single test are meaningful, but cannot be compared against audit emit ordering.

seq_ref?

type { value: number; } | undefined
optional

returns

RecordingCloser

RecordedClose
#

RecordingCloser
#

Depends on
#