1import type { ScratchStack } from "@/Test/Alchemy";
2import { scratchStack } from "@/Test/Core";
3import { expect } from "alchemy-test";
4import * as Effect from "effect/Effect";
5import { throughProxy } from "./transport.ts";
6
7/** Fresh engine/provider/state layers address the same durable test.provider rows. */
8export const engineActor = (
9 parent: ScratchStack,
10 title: string,
11 file: string,
12 endpoint?: string,
13) =>
14 Effect.sync(() => {
15 const actor = scratchStack(
16 {
17 providers: throughProxy(() => endpoint),
18 stage: parent.stage,
19 },
20 title,
21 file,
22 );
23 expect(actor.name).toBe(parent.name);
24 expect(actor.stage).toBe(parent.stage);
25 expect(actor.state).not.toBe(parent.state);
26 return actor;
27 });