@@ -56,10 +56,10 @@ describe('useManagerState', () => {
56
56
} )
57
57
58
58
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' , ( ) => {
60
60
vi . mocked ( useSystemStatsStore ) . mockReturnValue ( {
61
61
systemStats : ref ( {
62
- system : { argv : [ 'python' , 'main.py' , '--disable -manager' ] }
62
+ system : { argv : [ 'python' , 'main.py' ] } // No --enable -manager flag
63
63
} ) ,
64
64
isInitialized : ref ( true )
65
65
} as any )
@@ -76,7 +76,14 @@ describe('useManagerState', () => {
76
76
it ( 'should return LEGACY_UI state when --enable-manager-legacy-ui is present' , ( ) => {
77
77
vi . mocked ( useSystemStatsStore ) . mockReturnValue ( {
78
78
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
80
87
} ) ,
81
88
isInitialized : ref ( true )
82
89
} as any )
@@ -92,7 +99,9 @@ describe('useManagerState', () => {
92
99
93
100
it ( 'should return NEW_UI state when client and server both support v4' , ( ) => {
94
101
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
96
105
isInitialized : ref ( true )
97
106
} as any )
98
107
vi . mocked ( api . getClientFeatureFlags ) . mockReturnValue ( {
@@ -114,7 +123,9 @@ describe('useManagerState', () => {
114
123
115
124
it ( 'should return LEGACY_UI state when server supports v4 but client does not' , ( ) => {
116
125
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
118
129
isInitialized : ref ( true )
119
130
} as any )
120
131
vi . mocked ( api . getClientFeatureFlags ) . mockReturnValue ( {
@@ -136,7 +147,9 @@ describe('useManagerState', () => {
136
147
137
148
it ( 'should return LEGACY_UI state when legacy manager extension exists' , ( ) => {
138
149
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
140
153
isInitialized : ref ( true )
141
154
} as any )
142
155
vi . mocked ( api . getClientFeatureFlags ) . mockReturnValue ( { } )
@@ -155,7 +168,9 @@ describe('useManagerState', () => {
155
168
156
169
it ( 'should return NEW_UI state when server feature flags are undefined' , ( ) => {
157
170
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
159
174
isInitialized : ref ( true )
160
175
} as any )
161
176
vi . mocked ( api . getClientFeatureFlags ) . mockReturnValue ( { } )
@@ -175,7 +190,9 @@ describe('useManagerState', () => {
175
190
176
191
it ( 'should return LEGACY_UI state when server does not support v4' , ( ) => {
177
192
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
179
196
isInitialized : ref ( true )
180
197
} as any )
181
198
vi . mocked ( api . getClientFeatureFlags ) . mockReturnValue ( { } )
@@ -212,14 +229,17 @@ describe('useManagerState', () => {
212
229
213
230
const managerState = useManagerState ( )
214
231
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 )
216
234
} )
217
235
} )
218
236
219
237
describe ( 'helper properties' , ( ) => {
220
238
it ( 'isManagerEnabled should return true when state is not DISABLED' , ( ) => {
221
239
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
223
243
isInitialized : ref ( true )
224
244
} as any )
225
245
vi . mocked ( api . getClientFeatureFlags ) . mockReturnValue ( {
@@ -237,7 +257,7 @@ describe('useManagerState', () => {
237
257
it ( 'isManagerEnabled should return false when state is DISABLED' , ( ) => {
238
258
vi . mocked ( useSystemStatsStore ) . mockReturnValue ( {
239
259
systemStats : ref ( {
240
- system : { argv : [ 'python' , 'main.py' , '--disable -manager' ] }
260
+ system : { argv : [ 'python' , 'main.py' ] } // No --enable -manager flag means disabled
241
261
} ) ,
242
262
isInitialized : ref ( true )
243
263
} as any )
@@ -252,7 +272,9 @@ describe('useManagerState', () => {
252
272
253
273
it ( 'isNewManagerUI should return true when state is NEW_UI' , ( ) => {
254
274
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
256
278
isInitialized : ref ( true )
257
279
} as any )
258
280
vi . mocked ( api . getClientFeatureFlags ) . mockReturnValue ( {
@@ -270,7 +292,14 @@ describe('useManagerState', () => {
270
292
it ( 'isLegacyManagerUI should return true when state is LEGACY_UI' , ( ) => {
271
293
vi . mocked ( useSystemStatsStore ) . mockReturnValue ( {
272
294
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
274
303
} ) ,
275
304
isInitialized : ref ( true )
276
305
} as any )
@@ -285,7 +314,9 @@ describe('useManagerState', () => {
285
314
286
315
it ( 'shouldShowInstallButton should return true only for NEW_UI' , ( ) => {
287
316
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
289
320
isInitialized : ref ( true )
290
321
} as any )
291
322
vi . mocked ( api . getClientFeatureFlags ) . mockReturnValue ( {
@@ -302,7 +333,9 @@ describe('useManagerState', () => {
302
333
303
334
it ( 'shouldShowManagerButtons should return true when not DISABLED' , ( ) => {
304
335
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
306
339
isInitialized : ref ( true )
307
340
} as any )
308
341
vi . mocked ( api . getClientFeatureFlags ) . mockReturnValue ( {
0 commit comments