@@ -56,10 +56,10 @@ describe('useManagerState', () => {
5656 } )
5757
5858 describe ( 'managerUIState property' , ( ) => {
59- it ( 'should return DISABLED state when --disable -manager is present' , ( ) => {
59+ it ( 'should return DISABLED state when --enable -manager is NOT present' , ( ) => {
6060 vi . mocked ( useSystemStatsStore ) . mockReturnValue ( {
6161 systemStats : ref ( {
62- system : { argv : [ 'python' , 'main.py' , '--disable -manager' ] }
62+ system : { argv : [ 'python' , 'main.py' ] } // No --enable -manager flag
6363 } ) ,
6464 isInitialized : ref ( true )
6565 } as any )
@@ -76,7 +76,14 @@ describe('useManagerState', () => {
7676 it ( 'should return LEGACY_UI state when --enable-manager-legacy-ui is present' , ( ) => {
7777 vi . mocked ( useSystemStatsStore ) . mockReturnValue ( {
7878 systemStats : ref ( {
79- system : { argv : [ 'python' , 'main.py' , '--enable-manager-legacy-ui' ] }
79+ system : {
80+ argv : [
81+ 'python' ,
82+ 'main.py' ,
83+ '--enable-manager' ,
84+ '--enable-manager-legacy-ui'
85+ ]
86+ } // Both flags needed
8087 } ) ,
8188 isInitialized : ref ( true )
8289 } as any )
@@ -92,7 +99,9 @@ describe('useManagerState', () => {
9299
93100 it ( 'should return NEW_UI state when client and server both support v4' , ( ) => {
94101 vi . mocked ( useSystemStatsStore ) . mockReturnValue ( {
95- systemStats : ref ( { system : { argv : [ 'python' , 'main.py' ] } } ) ,
102+ systemStats : ref ( {
103+ system : { argv : [ 'python' , 'main.py' , '--enable-manager' ] }
104+ } ) , // Need --enable-manager
96105 isInitialized : ref ( true )
97106 } as any )
98107 vi . mocked ( api . getClientFeatureFlags ) . mockReturnValue ( {
@@ -114,7 +123,9 @@ describe('useManagerState', () => {
114123
115124 it ( 'should return LEGACY_UI state when server supports v4 but client does not' , ( ) => {
116125 vi . mocked ( useSystemStatsStore ) . mockReturnValue ( {
117- systemStats : ref ( { system : { argv : [ 'python' , 'main.py' ] } } ) ,
126+ systemStats : ref ( {
127+ system : { argv : [ 'python' , 'main.py' , '--enable-manager' ] }
128+ } ) , // Need --enable-manager
118129 isInitialized : ref ( true )
119130 } as any )
120131 vi . mocked ( api . getClientFeatureFlags ) . mockReturnValue ( {
@@ -136,7 +147,9 @@ describe('useManagerState', () => {
136147
137148 it ( 'should return LEGACY_UI state when legacy manager extension exists' , ( ) => {
138149 vi . mocked ( useSystemStatsStore ) . mockReturnValue ( {
139- systemStats : ref ( { system : { argv : [ 'python' , 'main.py' ] } } ) ,
150+ systemStats : ref ( {
151+ system : { argv : [ 'python' , 'main.py' , '--enable-manager' ] }
152+ } ) , // Need --enable-manager
140153 isInitialized : ref ( true )
141154 } as any )
142155 vi . mocked ( api . getClientFeatureFlags ) . mockReturnValue ( { } )
@@ -155,7 +168,9 @@ describe('useManagerState', () => {
155168
156169 it ( 'should return NEW_UI state when server feature flags are undefined' , ( ) => {
157170 vi . mocked ( useSystemStatsStore ) . mockReturnValue ( {
158- systemStats : ref ( { system : { argv : [ 'python' , 'main.py' ] } } ) ,
171+ systemStats : ref ( {
172+ system : { argv : [ 'python' , 'main.py' , '--enable-manager' ] }
173+ } ) , // Need --enable-manager
159174 isInitialized : ref ( true )
160175 } as any )
161176 vi . mocked ( api . getClientFeatureFlags ) . mockReturnValue ( { } )
@@ -175,7 +190,9 @@ describe('useManagerState', () => {
175190
176191 it ( 'should return LEGACY_UI state when server does not support v4' , ( ) => {
177192 vi . mocked ( useSystemStatsStore ) . mockReturnValue ( {
178- systemStats : ref ( { system : { argv : [ 'python' , 'main.py' ] } } ) ,
193+ systemStats : ref ( {
194+ system : { argv : [ 'python' , 'main.py' , '--enable-manager' ] }
195+ } ) , // Need --enable-manager
179196 isInitialized : ref ( true )
180197 } as any )
181198 vi . mocked ( api . getClientFeatureFlags ) . mockReturnValue ( { } )
@@ -212,14 +229,17 @@ describe('useManagerState', () => {
212229
213230 const managerState = useManagerState ( )
214231
215- expect ( managerState . managerUIState . value ) . toBe ( ManagerUIState . NEW_UI )
232+ // When systemStats is null, we can't check for --enable-manager flag, so manager is disabled
233+ expect ( managerState . managerUIState . value ) . toBe ( ManagerUIState . DISABLED )
216234 } )
217235 } )
218236
219237 describe ( 'helper properties' , ( ) => {
220238 it ( 'isManagerEnabled should return true when state is not DISABLED' , ( ) => {
221239 vi . mocked ( useSystemStatsStore ) . mockReturnValue ( {
222- systemStats : ref ( { system : { argv : [ 'python' , 'main.py' ] } } ) ,
240+ systemStats : ref ( {
241+ system : { argv : [ 'python' , 'main.py' , '--enable-manager' ] }
242+ } ) , // Need --enable-manager
223243 isInitialized : ref ( true )
224244 } as any )
225245 vi . mocked ( api . getClientFeatureFlags ) . mockReturnValue ( {
@@ -237,7 +257,7 @@ describe('useManagerState', () => {
237257 it ( 'isManagerEnabled should return false when state is DISABLED' , ( ) => {
238258 vi . mocked ( useSystemStatsStore ) . mockReturnValue ( {
239259 systemStats : ref ( {
240- system : { argv : [ 'python' , 'main.py' , '--disable -manager' ] }
260+ system : { argv : [ 'python' , 'main.py' ] } // No --enable -manager flag means disabled
241261 } ) ,
242262 isInitialized : ref ( true )
243263 } as any )
@@ -252,7 +272,9 @@ describe('useManagerState', () => {
252272
253273 it ( 'isNewManagerUI should return true when state is NEW_UI' , ( ) => {
254274 vi . mocked ( useSystemStatsStore ) . mockReturnValue ( {
255- systemStats : ref ( { system : { argv : [ 'python' , 'main.py' ] } } ) ,
275+ systemStats : ref ( {
276+ system : { argv : [ 'python' , 'main.py' , '--enable-manager' ] }
277+ } ) , // Need --enable-manager
256278 isInitialized : ref ( true )
257279 } as any )
258280 vi . mocked ( api . getClientFeatureFlags ) . mockReturnValue ( {
@@ -270,7 +292,14 @@ describe('useManagerState', () => {
270292 it ( 'isLegacyManagerUI should return true when state is LEGACY_UI' , ( ) => {
271293 vi . mocked ( useSystemStatsStore ) . mockReturnValue ( {
272294 systemStats : ref ( {
273- system : { argv : [ 'python' , 'main.py' , '--enable-manager-legacy-ui' ] }
295+ system : {
296+ argv : [
297+ 'python' ,
298+ 'main.py' ,
299+ '--enable-manager' ,
300+ '--enable-manager-legacy-ui'
301+ ]
302+ } // Both flags needed
274303 } ) ,
275304 isInitialized : ref ( true )
276305 } as any )
@@ -285,7 +314,9 @@ describe('useManagerState', () => {
285314
286315 it ( 'shouldShowInstallButton should return true only for NEW_UI' , ( ) => {
287316 vi . mocked ( useSystemStatsStore ) . mockReturnValue ( {
288- systemStats : ref ( { system : { argv : [ 'python' , 'main.py' ] } } ) ,
317+ systemStats : ref ( {
318+ system : { argv : [ 'python' , 'main.py' , '--enable-manager' ] }
319+ } ) , // Need --enable-manager
289320 isInitialized : ref ( true )
290321 } as any )
291322 vi . mocked ( api . getClientFeatureFlags ) . mockReturnValue ( {
@@ -302,7 +333,9 @@ describe('useManagerState', () => {
302333
303334 it ( 'shouldShowManagerButtons should return true when not DISABLED' , ( ) => {
304335 vi . mocked ( useSystemStatsStore ) . mockReturnValue ( {
305- systemStats : ref ( { system : { argv : [ 'python' , 'main.py' ] } } ) ,
336+ systemStats : ref ( {
337+ system : { argv : [ 'python' , 'main.py' , '--enable-manager' ] }
338+ } ) , // Need --enable-manager
306339 isInitialized : ref ( true )
307340 } as any )
308341 vi . mocked ( api . getClientFeatureFlags ) . mockReturnValue ( {
0 commit comments