Skip to content

Commit 9448e45

Browse files
committed
Add filesystem browse RPC forwarding test
Test that filesystem.browse requests are forwarded to the RPC client with correct parameters
1 parent b56b708 commit 9448e45

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎apps/web/src/localApi.test.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ const rpcClientMock = {
5151
searchEntries: vi.fn(),
5252
writeFile: vi.fn(),
5353
},
54+
filesystem: {
55+
browse: vi.fn(),
56+
},
5457
shell: {
5558
openInEditor: vi.fn(),
5659
},
@@ -415,6 +418,25 @@ describe("wsApi", () => {
415418
});
416419
});
417420

421+
it("forwards filesystem browse requests to the RPC client", async () => {
422+
rpcClientMock.filesystem.browse.mockResolvedValue({
423+
parentPath: "/tmp/project/",
424+
entries: [],
425+
});
426+
const { createEnvironmentApi } = await import("./environmentApi");
427+
428+
const api = createEnvironmentApi(rpcClientMock as never);
429+
await api.filesystem.browse({
430+
partialPath: "/tmp/project/",
431+
cwd: "/tmp/project",
432+
});
433+
434+
expect(rpcClientMock.filesystem.browse).toHaveBeenCalledWith({
435+
partialPath: "/tmp/project/",
436+
cwd: "/tmp/project",
437+
});
438+
});
439+
418440
it("forwards full-thread diff requests to the orchestration RPC", async () => {
419441
rpcClientMock.orchestration.getFullThreadDiff.mockResolvedValue({ diff: "patch" });
420442
const { createEnvironmentApi } = await import("./environmentApi");

0 commit comments

Comments
 (0)