Skip to content

Commit e5bf380

Browse files
yyq1025claude
andcommitted
daemon: fix getFilesystemRoots test's macOS-shaped $HOME assumption
The handler's contract makes desktop/documents optional — present iff the directory exists (ubuntu CI runners have neither). Assert the existence-filtered value instead of assuming ~/Desktop exists. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 096de7c commit e5bf380

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

packages/daemon/src/router.test.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
1+
import {
2+
existsSync,
3+
mkdirSync,
4+
mkdtempSync,
5+
rmSync,
6+
writeFileSync,
7+
} from "node:fs";
28
import { homedir, tmpdir } from "node:os";
39
import path from "node:path";
410
import type {
@@ -1792,8 +1798,16 @@ describe("createCommandHandler — getFilesystemRoots", () => {
17921798
throw new Error("expected response");
17931799
const home = homedir();
17941800
expect(sent[0].home).toBe(home);
1795-
expect(sent[0].desktop).toBe(path.join(home, "Desktop"));
1796-
expect(sent[0].documents).toBe(path.join(home, "Documents"));
1801+
// Desktop/Documents are OPTIONAL by contract: present iff the dir
1802+
// exists on disk (macOS always has both; Linux CI runners have
1803+
// neither). Mirror the handler's existence filter instead of
1804+
// assuming a macOS-shaped $HOME.
1805+
const desktop = path.join(home, "Desktop");
1806+
expect(sent[0].desktop).toBe(existsSync(desktop) ? desktop : undefined);
1807+
const documents = path.join(home, "Documents");
1808+
expect(sent[0].documents).toBe(
1809+
existsSync(documents) ? documents : undefined,
1810+
);
17971811
expect(sent[0].recentCwds).toEqual([]); // no sessions = no recents
17981812
});
17991813

0 commit comments

Comments
 (0)