| 1 | import type { ScratchStack } from "@/Test/Alchemy"; |
| 2 | import { scratchStack } from "@/Test/Core"; |
| 3 | import { expect } from "alchemy-test"; |
| 4 | import * as Effect from "effect/Effect"; |
| 5 | import { throughProxy } from "./transport.ts"; |
| 6 | |
| 7 | /** Fresh engine/provider/state layers address the same durable test.provider rows. */ |
| 8 | export 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 | }); |