1// Relative import (not `@/` alias) so this file runs under both Bun and Node
2// without a paths-aware loader. This fixture is excluded from the test
3// project's typecheck (see tsconfig.test.json) because the relative path
4// crosses composite-project boundaries.
5import * as Context from "effect/Context";
6import * as Effect from "effect/Effect";
7import * as Layer from "effect/Layer";
8import { launch } from "../../../src/Local/RpcServer.ts";
9
10/**
11 * Minimal test fixture for `RpcServer.launch`. Registers a single service
12 * keyed by `"Test.Echo"` which is what the parent looks up via
13 * `getProvider("Test.Echo")`.
14 */
15export class TestEcho extends Context.Service<
16 TestEcho,
17 {
18 echo: (msg: string) => Effect.Effect<string>;
19 boom: () => Effect.Effect<never, { _tag: "Boom"; msg: string }>;
20 }
21>()("Test.Echo") {}
22
23const TestEchoLive = Layer.succeed(TestEcho, {
24 echo: (msg) => Effect.succeed(`echo:${msg}`),
25 boom: () => Effect.fail({ _tag: "Boom" as const, msg: "kaboom" }),
26});
27
28launch(TestEchoLive);