@@ -207,3 +207,37 @@ suite('shouldEnvExtHandleActivation', () => {
207207 assert . strictEqual ( extapi . shouldEnvExtHandleActivation ( ) , false ) ;
208208 } ) ;
209209} ) ;
210+
211+ suite ( 'useEnvExtension' , ( ) => {
212+ let getConfigurationStub : sinon . SinonStub ;
213+
214+ setup ( ( ) => {
215+ extapi . EnvExtApiInternalTests . resetState ( ) ;
216+ const getExtensionStub : sinon . SinonStub = sinon . stub ( extensionsApi , 'getExtension' ) ;
217+ getExtensionStub . returns ( { id : extapi . ENVS_EXTENSION_ID } ) ;
218+ sinon . stub ( workspaceApis , 'getWorkspaceFolders' ) . returns ( undefined ) ;
219+ getConfigurationStub = sinon . stub ( workspaceApis , 'getConfiguration' ) ;
220+ getConfigurationStub . returns ( {
221+ get : ( ) => true ,
222+ inspect : ( ) => ( { globalValue : false , workspaceValue : true } ) ,
223+ } ) ;
224+ } ) ;
225+
226+ teardown ( ( ) => {
227+ extapi . EnvExtApiInternalTests . resetState ( ) ;
228+ sinon . restore ( ) ;
229+ } ) ;
230+
231+ test ( 'Returns false when the effective workspace value is true but the global value is false' , ( ) => {
232+ assert . strictEqual ( extapi . useEnvExtension ( ) , false ) ;
233+ } ) ;
234+
235+ test ( 'Returns true when the effective value is true and no scope explicitly disables the extension' , ( ) => {
236+ getConfigurationStub . returns ( {
237+ get : ( ) => true ,
238+ inspect : ( ) => ( { globalValue : undefined , workspaceValue : true } ) ,
239+ } ) ;
240+
241+ assert . strictEqual ( extapi . useEnvExtension ( ) , true ) ;
242+ } ) ;
243+ } ) ;
0 commit comments