@oona/vlo / testing / fakeClock
Function: fakeClock()
fakeClock(
startMs):Clock
Defined in: sdk/ts/sdk/src/journal/fixtures.ts:37
A Clock that starts at startMs and only moves when advance is called, so leases, timers and timeouts expire exactly when a test says so.
Parameters
startMs
number
Returns
Example
ts
import { fakeClock } from "@oona/vlo/testing";
const clock = fakeClock(1_700_000_000_000);
const host = createHost({
journal: "sqlite://:memory:",
workflows: [workflow],
now: clock.now,
dispatcher: { tickMs: 10 },
});
await host.start();
clock.advance(60_001); // one whole default lease and a millisecond