Skip to content

TestKit

Defined in: src/testkit/TestKit.ts:24

Convenience fassade to create an ActorSystem pre-wired for deterministic testing: NoopLogger by default and a TestProbe factory handy.

Typical usage:

const tk = TestKit.create(‘my-spec’); const probe = tk.createTestProbe(); const ref = tk.system.actorOf(Props.create(() => new Worker(probe)), ‘worker’); ref.tell(‘go’); await probe.expectMsg(‘done’); await tk.shutdown();

readonly system: ActorSystem

Defined in: src/testkit/TestKit.ts:25

createTestProbe(opts?): TestProbe

Defined in: src/testkit/TestKit.ts:42

Create a TestProbe scoped to this kit’s system.

TestProbeOptions = {}

TestProbe


shutdown(): Promise<void>

Defined in: src/testkit/TestKit.ts:58

Tear the system down at the end of a test.

Promise<void>


within<T>(durationMs, fn): Promise<T>

Defined in: src/testkit/TestKit.ts:47

Run fn with a soft deadline; throws if it takes longer than durationMs.

T

number

() => Promise<T>

Promise<T>


static create(name?, options?): TestKit

Defined in: src/testkit/TestKit.ts:31

string = 'test-kit'

TestKitOptions = {}

TestKit


static withManualScheduler(name?, options?): object

Defined in: src/testkit/TestKit.ts:66

Build a TestKit that uses a ManualScheduler so that timers fire deterministically via scheduler.advance(ms).

string = 'test-kit-manual'

Omit<TestKitOptions, "scheduler"> = {}

object

kit: TestKit

scheduler: ManualScheduler