@@ -101,7 +101,7 @@ jest.mock('../extension', () => ({
101101
102102function makeContext ( ) : any {
103103 return {
104- globalState : {
104+ workspaceState : {
105105 get : jest . fn ( ) . mockReturnValue ( undefined ) ,
106106 update : jest . fn ( ) . mockResolvedValue ( undefined ) ,
107107 } ,
@@ -139,7 +139,7 @@ describe('EnvManager', () => {
139139
140140 describe ( 'init()' , ( ) => {
141141 test ( 'loads a valid saved environment and does not call silentAutoSelect' , async ( ) => {
142- context . globalState . get . mockReturnValue ( '/saved/jac' ) ;
142+ context . workspaceState . get . mockReturnValue ( '/saved/jac' ) ;
143143 ( envDetection . validateJacExecutable as jest . Mock ) . mockResolvedValue ( true ) ;
144144 ( envVersion . getJacVersion as jest . Mock ) . mockResolvedValue ( '0.11.0' ) ;
145145
@@ -151,20 +151,20 @@ describe('EnvManager', () => {
151151 } ) ;
152152
153153 test ( 'clears an invalid saved environment and falls through to silentAutoSelect' , async ( ) => {
154- context . globalState . get . mockReturnValue ( '/invalid/jac' ) ;
154+ context . workspaceState . get . mockReturnValue ( '/invalid/jac' ) ;
155155 ( envDetection . validateJacExecutable as jest . Mock ) . mockResolvedValue ( false ) ;
156156 ( envDetection . discoverJacEnvironments as jest . Mock ) . mockResolvedValue ( [ ] ) ;
157157 ( vscode . window . showInformationMessage as jest . Mock ) . mockResolvedValue ( undefined ) ;
158158
159159 await envManager . init ( ) ;
160160
161- expect ( context . globalState . update ) . toHaveBeenCalledWith ( 'jacEnvPath' , undefined ) ;
161+ expect ( context . workspaceState . update ) . toHaveBeenCalledWith ( 'jacEnvPath' , undefined ) ;
162162 expect ( envDetection . discoverJacEnvironments ) . toHaveBeenCalled ( ) ;
163163 expect ( ( envManager as any ) . statusBar . text ) . toContain ( 'No Env' ) ;
164164 } ) ;
165165
166166 test ( 'runs silentAutoSelect when no saved environment exists' , async ( ) => {
167- context . globalState . get . mockReturnValue ( undefined ) ;
167+ context . workspaceState . get . mockReturnValue ( undefined ) ;
168168 ( envDetection . discoverJacEnvironments as jest . Mock ) . mockResolvedValue ( [ ] ) ;
169169 ( vscode . window . showInformationMessage as jest . Mock ) . mockResolvedValue ( undefined ) ;
170170
@@ -185,7 +185,7 @@ describe('EnvManager', () => {
185185
186186 await ( envManager as any ) . silentAutoSelect ( ) ;
187187
188- expect ( context . globalState . update ) . toHaveBeenCalledWith ( 'jacEnvPath' , '/envs/venv/bin/jac' ) ;
188+ expect ( context . workspaceState . update ) . toHaveBeenCalledWith ( 'jacEnvPath' , '/envs/venv/bin/jac' ) ;
189189 expect ( vscode . window . showInformationMessage ) . not . toHaveBeenCalled ( ) ;
190190 expect ( vscode . window . showWarningMessage ) . not . toHaveBeenCalled ( ) ;
191191 } ) ;
@@ -204,7 +204,7 @@ describe('EnvManager', () => {
204204
205205 await ( envManager as any ) . silentAutoSelect ( ) ;
206206
207- expect ( context . globalState . update ) . toHaveBeenCalledWith ( 'jacEnvPath' , '/envs/new/bin/jac' ) ;
207+ expect ( context . workspaceState . update ) . toHaveBeenCalledWith ( 'jacEnvPath' , '/envs/new/bin/jac' ) ;
208208 } ) ;
209209
210210 test ( 'selects the first environment when versions are equal (stable tie-break)' , async ( ) => {
@@ -216,7 +216,7 @@ describe('EnvManager', () => {
216216
217217 await ( envManager as any ) . silentAutoSelect ( ) ;
218218
219- expect ( context . globalState . update ) . toHaveBeenCalledWith ( 'jacEnvPath' , '/envs/first/bin/jac' ) ;
219+ expect ( context . workspaceState . update ) . toHaveBeenCalledWith ( 'jacEnvPath' , '/envs/first/bin/jac' ) ;
220220 } ) ;
221221
222222 test ( 'falls back to the first environment when none have a detectable version' , async ( ) => {
@@ -228,7 +228,7 @@ describe('EnvManager', () => {
228228
229229 await ( envManager as any ) . silentAutoSelect ( ) ;
230230
231- expect ( context . globalState . update ) . toHaveBeenCalledWith ( 'jacEnvPath' , '/envs/a/bin/jac' ) ;
231+ expect ( context . workspaceState . update ) . toHaveBeenCalledWith ( 'jacEnvPath' , '/envs/a/bin/jac' ) ;
232232 } ) ;
233233
234234 test ( 'shows a toast with Install/Select options when no environments are found' , async ( ) => {
@@ -242,7 +242,7 @@ describe('EnvManager', () => {
242242 'Install Jac' ,
243243 'Select Manually'
244244 ) ;
245- expect ( context . globalState . update ) . not . toHaveBeenCalled ( ) ;
245+ expect ( context . workspaceState . update ) . not . toHaveBeenCalled ( ) ;
246246 } ) ;
247247
248248 test ( 'opens the install page when the user clicks "Install Jac"' , async ( ) => {
@@ -276,7 +276,7 @@ describe('EnvManager', () => {
276276 await ( envManager as any ) . handleManualPathEntry ( ) ;
277277
278278 expect ( envDetection . validateJacExecutable ) . toHaveBeenCalledWith ( '/valid/jac' ) ;
279- expect ( context . globalState . update ) . toHaveBeenCalledWith ( 'jacEnvPath' , '/valid/jac' ) ;
279+ expect ( context . workspaceState . update ) . toHaveBeenCalledWith ( 'jacEnvPath' , '/valid/jac' ) ;
280280 expect ( createAndStartLsp ) . toHaveBeenCalledTimes ( 1 ) ;
281281 } ) ;
282282
@@ -297,7 +297,7 @@ describe('EnvManager', () => {
297297
298298 await ( envManager as any ) . handleManualPathEntry ( ) ;
299299
300- expect ( context . globalState . update ) . not . toHaveBeenCalled ( ) ;
300+ expect ( context . workspaceState . update ) . not . toHaveBeenCalled ( ) ;
301301 expect ( envDetection . validateJacExecutable ) . not . toHaveBeenCalled ( ) ;
302302 } ) ;
303303
@@ -349,7 +349,7 @@ describe('EnvManager', () => {
349349
350350 await ( envManager as any ) . handleFileBrowser ( ) ;
351351
352- expect ( context . globalState . update ) . toHaveBeenCalledWith ( 'jacEnvPath' , '/browser/jac' ) ;
352+ expect ( context . workspaceState . update ) . toHaveBeenCalledWith ( 'jacEnvPath' , '/browser/jac' ) ;
353353 expect ( createAndStartLsp ) . toHaveBeenCalledTimes ( 1 ) ;
354354 } ) ;
355355
@@ -358,7 +358,7 @@ describe('EnvManager', () => {
358358
359359 await ( envManager as any ) . handleFileBrowser ( ) ;
360360
361- expect ( context . globalState . update ) . not . toHaveBeenCalled ( ) ;
361+ expect ( context . workspaceState . update ) . not . toHaveBeenCalled ( ) ;
362362 expect ( envDetection . validateJacExecutable ) . not . toHaveBeenCalled ( ) ;
363363 } ) ;
364364
0 commit comments