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
63const asTurnId = (value: string): TurnId => TurnId.makeUnsafe(value);63const asTurnId = (value: string): TurnId => TurnId.makeUnsafe(value);
64 64
65const defaultOpenService: OpenShape = {65const defaultOpenService: OpenShape = {
66 getAvailableEditors: Effect.succeed([]),
67 openExternal: () => Effect.void,
66 openBrowser: () => Effect.void,68 openBrowser: () => Effect.void,
67 openInEditor: () => Effect.void,69 openInEditor: () => Effect.void,
68};70};
@@ -1030,6 +1032,8 @@ describe("WebSocket Server", () => { · 961 unmodified lines
1030 it("routes shell.openInEditor through the injected open service", async () => {1032 it("routes shell.openInEditor through the injected open service", async () => {
1031 const openCalls: Array<{ cwd: string; editor: string }> = [];1033 const openCalls: Array<{ cwd: string; editor: string }> = [];
1032 const openService: OpenShape = {1034 const openService: OpenShape = {
1035 getAvailableEditors: Effect.succeed([]),
1036 openExternal: () => Effect.void,
1033 openBrowser: () => Effect.void,1037 openBrowser: () => Effect.void,
1034 openInEditor: (input) => {1038 openInEditor: (input) => {
1035 openCalls.push({ cwd: input.cwd, editor: input.editor });1039 openCalls.push({ cwd: input.cwd, editor: input.editor });
@@ -1531,6 +1535,8 @@ describe("WebSocket Server", () => { · 495 unmodified lines
1531 process.on("unhandledRejection", onUnhandledRejection);1535 process.on("unhandledRejection", onUnhandledRejection);
1532 1536
1533 const brokenOpenService: OpenShape = {1537 const brokenOpenService: OpenShape = {
1538 getAvailableEditors: Effect.succeed([]),
1539 openExternal: () => Effect.void,
1534 openBrowser: () => Effect.void,1540 openBrowser: () => Effect.void,
1535 openInEditor: () =>1541 openInEditor: () =>
1536 Effect.sync(() => BigInt(1)).pipe(Effect.map((result) => result as unknown as void)),1542 Effect.sync(() => BigInt(1)).pipe(Effect.map((result) => result as unknown as void)),