@@ -6,36 +6,65 @@ import { SETTINGS_DIR_NAME } from "../branding.js";
66import { savedSkipPermissionsWarning } from "./saved-skip-warning.js" ;
77
88describe ( "savedSkipPermissionsWarning" , ( ) => {
9- test ( "default machine-wide source appends the /yolo off hint" , ( ) => {
9+ test ( "TUI default machine-wide source appends the /yolo off hint" , ( ) => {
1010 const source = join ( homedir ( ) , SETTINGS_DIR_NAME , "settings.json" ) ;
1111
12- const warning = savedSkipPermissionsWarning ( source ) ;
12+ const warning = savedSkipPermissionsWarning ( source , "tui" ) ;
1313
1414 expect ( warning ) . toContain ( source ) ;
1515 expect ( warning ) . toContain ( "edit that file to re-enable" ) ;
1616 expect ( warning ) . toContain ( "/yolo off" ) ;
1717 } ) ;
1818
19- test ( "symlinked-home alias of the default source still appends the hint" , async ( ) => {
19+ test ( "TUI symlinked-home alias of the default source still appends the hint" , async ( ) => {
2020 const sandbox = await mkdtemp ( join ( tmpdir ( ) , "corbits-skip-warning-" ) ) ;
2121 const homeLink = join ( sandbox , "home" ) ;
2222 await symlink ( homedir ( ) , homeLink ) ;
2323 const aliased = join ( homeLink , SETTINGS_DIR_NAME , "settings.json" ) ;
2424
25- const warning = savedSkipPermissionsWarning ( aliased ) ;
25+ const warning = savedSkipPermissionsWarning ( aliased , "tui" ) ;
2626
2727 expect ( warning ) . toContain ( aliased ) ;
2828 expect ( warning ) . toContain ( "edit that file to re-enable" ) ;
2929 expect ( warning ) . toContain ( "/yolo off" ) ;
3030 } ) ;
3131
32- test ( "custom source keeps file-path wording with no false provenance" , ( ) => {
33- const warning = savedSkipPermissionsWarning (
34- "/tmp/custom-corbits-settings.json" ,
32+ test ( "exec default source stays path-only with no slash" , ( ) => {
33+ const source = join ( homedir ( ) , SETTINGS_DIR_NAME , "settings.json" ) ;
34+
35+ const warning = savedSkipPermissionsWarning ( source , "exec" ) ;
36+
37+ expect ( warning ) . toContain ( source ) ;
38+ expect ( warning ) . toContain ( "edit that file to re-enable" ) ;
39+ expect ( warning ) . not . toContain ( "/yolo" ) ;
40+ expect ( warning ) . toBe (
41+ `Warning: permission prompts are disabled by saved settings at ${ source } ; edit that file to re-enable.` ,
3542 ) ;
43+ } ) ;
44+
45+ test ( "exec symlinked-home alias of the default source stays path-only" , async ( ) => {
46+ const sandbox = await mkdtemp ( join ( tmpdir ( ) , "corbits-skip-warning-" ) ) ;
47+ const homeLink = join ( sandbox , "home" ) ;
48+ await symlink ( homedir ( ) , homeLink ) ;
49+ const aliased = join ( homeLink , SETTINGS_DIR_NAME , "settings.json" ) ;
50+
51+ const warning = savedSkipPermissionsWarning ( aliased , "exec" ) ;
3652
37- expect ( warning ) . toContain ( "/tmp/custom-corbits-settings.json" ) ;
53+ expect ( warning ) . toContain ( aliased ) ;
3854 expect ( warning ) . toContain ( "edit that file to re-enable" ) ;
39- expect ( warning ) . not . toMatch ( / m a c h i n e - w i d e | s a v e d d e f a u l t | \/ y o l o o f f / i) ;
55+ expect ( warning ) . not . toContain ( "/yolo" ) ;
56+ } ) ;
57+
58+ test ( "custom source keeps file-path wording with no false provenance on both surfaces" , ( ) => {
59+ for ( const surface of [ "tui" , "exec" ] as const ) {
60+ const warning = savedSkipPermissionsWarning (
61+ "/tmp/custom-corbits-settings.json" ,
62+ surface ,
63+ ) ;
64+
65+ expect ( warning ) . toContain ( "/tmp/custom-corbits-settings.json" ) ;
66+ expect ( warning ) . toContain ( "edit that file to re-enable" ) ;
67+ expect ( warning ) . not . toMatch ( / m a c h i n e - w i d e | s a v e d d e f a u l t | \/ y o l o o f f / i) ;
68+ }
4069 } ) ;
4170} ) ;
0 commit comments