Ir al contenido
Español

TestKit

Esta página aún no está disponible en tu idioma.

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

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.spawn(() => new Worker(probe), ‘worker’); ref.tell(‘go’); await probe.expectMessage(‘done’); await tk.shutdown();

readonly system: ActorSystem

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

createTestProbe(options?): TestProbe

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

Create a TestProbe scoped to this kit’s system.

TestProbeOptions = {}

TestProbe


shutdown(): Promise<void>

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

Tear the system down at the end of a test.

Promise<void>


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

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

Run callback 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:28

string = 'test-kit'

TestKitOptions = {}

TestKit


static withManualScheduler(name?, options?): object

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

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

string = 'test-kit-manual'

TestKitOptions = {}

object

kit: TestKit

scheduler: ManualScheduler