11import { describe , expect , test } from "bun:test" ;
2- import { globalSettingsPath } from "../config/settings.js" ;
2+ import { mkdtemp , symlink } from "node:fs/promises" ;
3+ import { homedir , tmpdir } from "node:os" ;
4+ import { join } from "node:path" ;
5+ import { SETTINGS_DIR_NAME } from "../branding.js" ;
36import { savedSkipPermissionsWarning } from "./saved-skip-warning.js" ;
47
58describe ( "savedSkipPermissionsWarning" , ( ) => {
69 test ( "default machine-wide source appends the /yolo off hint" , ( ) => {
7- const source = globalSettingsPath ( ) ;
10+ const source = join ( homedir ( ) , SETTINGS_DIR_NAME , "settings.json" ) ;
811
912 const warning = savedSkipPermissionsWarning ( source ) ;
1013
@@ -13,6 +16,19 @@ describe("savedSkipPermissionsWarning", () => {
1316 expect ( warning ) . toContain ( "/yolo off" ) ;
1417 } ) ;
1518
19+ test ( "symlinked-home alias of the default source still appends the hint" , async ( ) => {
20+ const sandbox = await mkdtemp ( join ( tmpdir ( ) , "corbits-skip-warning-" ) ) ;
21+ const homeLink = join ( sandbox , "home" ) ;
22+ await symlink ( homedir ( ) , homeLink ) ;
23+ const aliased = join ( homeLink , SETTINGS_DIR_NAME , "settings.json" ) ;
24+
25+ const warning = savedSkipPermissionsWarning ( aliased ) ;
26+
27+ expect ( warning ) . toContain ( aliased ) ;
28+ expect ( warning ) . toContain ( "edit that file to re-enable" ) ;
29+ expect ( warning ) . toContain ( "/yolo off" ) ;
30+ } ) ;
31+
1632 test ( "custom source keeps file-path wording with no false provenance" , ( ) => {
1733 const warning = savedSkipPermissionsWarning (
1834 "/tmp/custom-corbits-settings.json" ,
0 commit comments