History

Refactor open service onto Effect-backed process spawning

- Add external opener support alongside browser/editor launches - Remove the `open` dependency and cover platform behavior in tests

Julius Marminge committed 7 months ago

Commit 2ade0371 parent 48fc85e7 files · +1125 −428Browse files

Showing the changes to apps/server/src/wsServer.test.ts (1 of 7 files). Show all

Unified · Split

apps/server/src/wsServer.test.ts+6−0
@@ -63,6 +63,8 @@ const asThreadId = (value: string): ThreadId => ThreadId.makeUnsafe(value); · 62 unmodified lines
6363 const asTurnId = (value: string): TurnId => TurnId.makeUnsafe(value);
6464
6565 const defaultOpenService: OpenShape = {
66+ getAvailableEditors: Effect.succeed([]),
67+ openExternal: () => Effect.void,
6668 openBrowser: () => Effect.void,
6769 openInEditor: () => Effect.void,
6870 };
@@ -1030,6 +1032,8 @@ describe("WebSocket Server", () => { · 961 unmodified lines
10301032 it("routes shell.openInEditor through the injected open service", async () => {
10311033 const openCalls: Array<{ cwd: string; editor: string }> = [];
10321034 const openService: OpenShape = {
1035+ getAvailableEditors: Effect.succeed([]),
1036+ openExternal: () => Effect.void,
10331037 openBrowser: () => Effect.void,
10341038 openInEditor: (input) => {
10351039 openCalls.push({ cwd: input.cwd, editor: input.editor });
@@ -1531,6 +1535,8 @@ describe("WebSocket Server", () => { · 495 unmodified lines
15311535 process.on("unhandledRejection", onUnhandledRejection);
15321536
15331537 const brokenOpenService: OpenShape = {
1538+ getAvailableEditors: Effect.succeed([]),
1539+ openExternal: () => Effect.void,
15341540 openBrowser: () => Effect.void,
15351541 openInEditor: () =>
15361542 Effect.sync(() => BigInt(1)).pipe(Effect.map((result) => result as unknown as void)),