Documentation
¶
Overview ¶
Package testing provides helpers for asserting on Actor behavior in unit tests. Not for use outside test code.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultContext ¶
DefaultContext returns the standard test context. Centralized so future tweaks (e.g. attaching a logger) apply to every test that uses the harness.
func WaitFor ¶
func WaitFor[Ctx any, Evt any]( a *fate.Actor[Ctx, Evt], pred func(fate.Snapshot[Ctx]) bool, timeout time.Duration, ) (fate.Snapshot[Ctx], error)
WaitFor blocks until the actor's snapshot satisfies pred or the deadline expires. The default deadline is 1 second; override with a non-zero timeout argument.
Types ¶
type Trace ¶
type Trace[Ctx any] struct { Snapshots []fate.Snapshot[Ctx] // contains filtered or unexported fields }
Trace returns a recorder that captures every snapshot emitted by the actor's Subscribe channel, in order. Useful for asserting on the sequence of states a test drives the actor through.
Click to show internal directories.
Click to hide internal directories.