Skip to content
HomePagesHomePages template kit

FixtureSpec

One fixture in authoring, built up by `scenario()` and its refiners (`.at()`/`.override()`).

One fixture in authoring, built up by scenario() and its refiners (.at()/.override()). Immutable — every refiner returns a NEW spec, so a shared base can fork per state without one state’s edits bleeding into another’s.

Import from @homepages/template-kit/fixtures.

export class FixtureSpec<S> {
declare readonly __schema?: S;
constructor(readonly state: SpecState) { }
at(variantCase: string): FixtureSpec<S> {
return new FixtureSpec<S>({
...this.state,
variantCase,
});
}
label(text: string): FixtureSpec<S> {
return new FixtureSpec<S>({ ...this.state, label: text });
}
override<M extends object>(partial: ExactMap<M, OverrideSlots<S>>): FixtureSpec<S> {
return new FixtureSpec<S>({
...this.state,
overrides: { ...this.state.overrides, ...(partial as Record<string, unknown>) },
});
}
}