Documentation
¶
Overview ¶
Package eventtest provides an in-memory publisher seam for tests: a Recorder that satisfies the same Publish signature as the real event.Publisher, so application code under test can publish without a running runtime and the test can assert on what was published. It is safe for concurrent use.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequireNone ¶
RequireNone asserts no event of type T was published.
Types ¶
type Record ¶
Record is one captured Publish call: the assigned event id, the event args, and how many publish options were passed.
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder captures Publish calls in memory.
func (*Recorder) Publish ¶
func (r *Recorder) Publish(_ context.Context, args event.EventArgs, opts ...event.PublishOption) (uuid.UUID, error)
Publish records the call and returns a fresh event id, matching the real event.Publisher.Publish signature so it drops in as a seam.
func (*Recorder) RequireLen ¶
RequireLen asserts exactly n events were published.