payloadfixture

package
v0.1.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package payloadfixture holds payload-registry fixtures for tests: an empty registry, a registry built from chosen registration functions, and a schema-less stub type. It lives in the harness, not in payloadregistry, because it imports testing and production code imports no test package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewForTest

func NewForTest(tb testing.TB) *payloadregistry.Registry

NewForTest returns a fresh empty Registry suitable for unit tests that want full isolation from other tests in the same process. Registers nothing — caller adds whatever payloads the test needs.

For tests that want the full first-party builtin set, the payloadbuiltins package provides a Register helper; tests in higher layers can call it after constructing a registry here. We don't import payloadbuiltins from this package because doing so would re-introduce the import cycle this package is structured to avoid.

func NewWithSubset

func NewWithSubset(tb testing.TB, regs ...func(*payloadregistry.Registry) error) *payloadregistry.Registry

NewWithSubset returns a fresh Registry populated by calling each supplied registration function in order. Useful when a test needs a subset of builtin payloads — e.g., only `agentic` types — without pulling in the full first-party set.

reg := payloadregistry.NewWithSubset(t, agentic.RegisterPayloads)

Aggregates registration errors via errors.Join; calls tb.Fatal on any error so the test terminates immediately.

func RegisterTestType

func RegisterTestType(tb testing.TB, reg *payloadregistry.Registry, mt types.Type)

RegisterTestType registers mt with a schema-less stub factory and no floor. tb.Fatalf on a registration error (including component grammar), so a test terminates at the fixture rather than at the first rejected create. The type is taken structured — nothing here or anywhere parses a key.

Types

This section is empty.

Jump to

Keyboard shortcuts

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