eventsfake

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package eventsfake provides test helpers for events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fake

type Fake struct {
	// contains filtered or unexported fields
}

Fake provides an assertion-oriented event bus test harness.

func New

func New() *Fake

New creates a new fake event harness.

func (*Fake) AssertCount

func (f *Fake) AssertCount(t testing.TB, want int)

AssertCount verifies the number of recorded publishes.

func (*Fake) AssertNothingPublished

func (f *Fake) AssertNothingPublished(t testing.TB)

AssertNothingPublished verifies that no publishes were recorded.

func (*Fake) Bus

func (f *Fake) Bus() events.API

Bus returns the wrapped API to inject into code under test.

func (*Fake) Count

func (f *Fake) Count() int

Count returns the total number of recorded publishes.

func (*Fake) Records

func (f *Fake) Records() []Record

Records returns a copy of recorded publishes.

func (*Fake) Reset

func (f *Fake) Reset()

Reset clears recorded publishes.

type Record

type Record struct {
	Event any
}

Record captures one published event observed by the fake.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL