Documentation
¶
Overview ¶
Package testutil offers shared helpers: in-memory DB, event builders, fixture loading. Test-only code.
Index ¶
- func AssertGolden(t *testing.T, name string, got map[string]any)
- func LoadFixture(t *testing.T, name string) []eventstore.Event
- func NewTestDB(t *testing.T) *sql.DB
- func StateChanged(entity string, brightness uint32, opts ...EventOption) eventstore.Event
- func SystemStartup(opts ...EventOption) eventstore.Event
- type EventOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertGolden ¶
AssertGolden compares got with testdata/fixtures/<name>.golden.json. Pass -update to regenerate.
func LoadFixture ¶
func LoadFixture(t *testing.T, name string) []eventstore.Event
LoadFixture reads testdata/fixtures/<name>.jsonl — one JSON object per line. Returns events with Position=0 (store assigns positions on Append).
func NewTestDB ¶
NewTestDB opens a file-backed SQLite in t.TempDir(), applies migrations, and returns the handle. File-backed rather than :memory: because WAL behavior differs and we want realism.
func StateChanged ¶
func StateChanged(entity string, brightness uint32, opts ...EventOption) eventstore.Event
func SystemStartup ¶
func SystemStartup(opts ...EventOption) eventstore.Event
Types ¶
type EventOption ¶
type EventOption func(*eventstore.Event)
func WithCause ¶
func WithCause(pos uint64) EventOption
func WithCorrelation ¶
func WithCorrelation(id uuid.UUID) EventOption
func WithSource ¶
func WithSource(s string) EventOption
func WithTimestamp ¶
func WithTimestamp(t time.Time) EventOption
Click to show internal directories.
Click to hide internal directories.