@@ -56,5 +56,37 @@ describe('session-set-defaults tool', () => {
5656 expect ( result . content [ 0 ] . text ) . toContain ( 'Parameter validation failed' ) ;
5757 expect ( result . content [ 0 ] . text ) . toContain ( 'useLatestOS' ) ;
5858 } ) ;
59+
60+ it ( 'should clear workspacePath when projectPath is set' , async ( ) => {
61+ sessionStore . setDefaults ( { workspacePath : '/old/App.xcworkspace' } ) ;
62+ await sessionSetDefaultsLogic ( { projectPath : '/new/App.xcodeproj' } ) ;
63+ const current = sessionStore . getAll ( ) ;
64+ expect ( current . projectPath ) . toBe ( '/new/App.xcodeproj' ) ;
65+ expect ( current . workspacePath ) . toBeUndefined ( ) ;
66+ } ) ;
67+
68+ it ( 'should clear projectPath when workspacePath is set' , async ( ) => {
69+ sessionStore . setDefaults ( { projectPath : '/old/App.xcodeproj' } ) ;
70+ await sessionSetDefaultsLogic ( { workspacePath : '/new/App.xcworkspace' } ) ;
71+ const current = sessionStore . getAll ( ) ;
72+ expect ( current . workspacePath ) . toBe ( '/new/App.xcworkspace' ) ;
73+ expect ( current . projectPath ) . toBeUndefined ( ) ;
74+ } ) ;
75+
76+ it ( 'should clear simulatorName when simulatorId is set' , async ( ) => {
77+ sessionStore . setDefaults ( { simulatorName : 'iPhone 16' } ) ;
78+ await sessionSetDefaultsLogic ( { simulatorId : 'SIM-UUID' } ) ;
79+ const current = sessionStore . getAll ( ) ;
80+ expect ( current . simulatorId ) . toBe ( 'SIM-UUID' ) ;
81+ expect ( current . simulatorName ) . toBeUndefined ( ) ;
82+ } ) ;
83+
84+ it ( 'should clear simulatorId when simulatorName is set' , async ( ) => {
85+ sessionStore . setDefaults ( { simulatorId : 'SIM-UUID' } ) ;
86+ await sessionSetDefaultsLogic ( { simulatorName : 'iPhone 16' } ) ;
87+ const current = sessionStore . getAll ( ) ;
88+ expect ( current . simulatorName ) . toBe ( 'iPhone 16' ) ;
89+ expect ( current . simulatorId ) . toBeUndefined ( ) ;
90+ } ) ;
5991 } ) ;
6092} ) ;
0 commit comments