testutil

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package testutil offers shared helpers: in-memory DB, event builders, fixture loading. Test-only code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertGolden

func AssertGolden(t *testing.T, name string, got map[string]any)

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

func NewTestDB(t *testing.T) *sql.DB

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

Jump to

Keyboard shortcuts

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