@camunda8/orchestration-cluster-api
    Preparing search index...

    Interface TestClock

    A Clock whose time only moves when the test says so, plus the counters a test needs to assert on. Everything beyond Clock is inspection or control, never behaviour the SDK depends on.

    interface TestClock {
        nowCalls: number;
        pending: number;
        sleeps: readonly number[];
        advance(ms: number): Promise<void>;
        deadline(ms: number): { dispose: () => void; signal: AbortSignal };
        now(): number;
        sleep(ms: number, signal?: AbortSignal): Promise<void>;
    }

    Hierarchy (View Summary)

    Index
    nowCalls: number

    How many times now has been read.

    pending: number

    Sleeps still waiting for time to advance.

    sleeps: readonly number[]

    Durations passed to sleep, in call order.

    • Move time forward by ms, settling every sleep that comes due, then drain the queue.

      Parameters

      • ms: number

      Returns Promise<void>

    • A signal that aborts once ms have elapsed on this clock.

      dispose() releases the underlying timer; call it when the guarded work finishes early, or a long deadline keeps a handle alive for its full duration.

      Parameters

      • ms: number

      Returns { dispose: () => void; signal: AbortSignal }

    • Resolve after ms have elapsed on this clock.

      Rejects with the signal's reason if signal aborts first, so a caller can cancel a wait without leaving the timer behind.

      An injected implementation must not resolve synchronously. The worker schedules its next poll by awaiting this, so a sleep that settles in a microtask turns the poll loop into an unbounded spin that starves the event loop and exhausts the heap. A test clock should resolve only when the test advances it.

      Parameters

      • ms: number
      • Optionalsignal: AbortSignal

      Returns Promise<void>