33
44import * as sinon from 'sinon' ;
55import * as TypeMoq from 'typemoq' ;
6- import { GlobalEnvironmentVariableCollection , Uri , WorkspaceConfiguration } from 'vscode' ;
6+ import { GlobalEnvironmentVariableCollection , Uri , WorkspaceConfiguration , Disposable } from 'vscode' ;
77import * as workspaceApis from '../../../client/common/vscodeApis/workspaceApis' ;
88import { registerPythonStartup } from '../../../client/terminals/pythonStartup' ;
99import { IExtensionContext } from '../../../client/common/types' ;
10+ import * as pythonStartupLinkProvider from '../../../client/terminals/pythonStartupLinkProvider' ;
1011
1112suite ( 'Terminal - Shell Integration with PYTHONSTARTUP' , ( ) => {
1213 let getConfigurationStub : sinon . SinonStub ;
@@ -20,7 +21,6 @@ suite('Terminal - Shell Integration with PYTHONSTARTUP', () => {
2021 setup ( ( ) => {
2122 context = TypeMoq . Mock . ofType < IExtensionContext > ( ) ;
2223 globalEnvironmentVariableCollection = TypeMoq . Mock . ofType < GlobalEnvironmentVariableCollection > ( ) ;
23-
2424 // Question: Why do we have to set up environmentVariableCollection and globalEnvironmentVariableCollection in this flip-flop way?
2525 // Reference: /vscode-python/src/test/interpreters/activation/terminalEnvVarCollectionService.unit.test.ts
2626 context . setup ( ( c ) => c . environmentVariableCollection ) . returns ( ( ) => globalEnvironmentVariableCollection . object ) ;
@@ -122,4 +122,18 @@ suite('Terminal - Shell Integration with PYTHONSTARTUP', () => {
122122
123123 globalEnvironmentVariableCollection . verify ( ( c ) => c . delete ( 'PYTHONSTARTUP' ) , TypeMoq . Times . once ( ) ) ;
124124 } ) ;
125+
126+ test ( 'Ensure registering terminal link calls registerTerminalLinkProvider' , async ( ) => {
127+ const registerTerminalLinkProviderStub = sinon . stub (
128+ pythonStartupLinkProvider ,
129+ 'registerCustomTerminalLinkProvider' ,
130+ ) ;
131+ const disposableArray : Disposable [ ] = [ ] ;
132+ pythonStartupLinkProvider . registerCustomTerminalLinkProvider ( disposableArray ) ;
133+
134+ sinon . assert . calledOnce ( registerTerminalLinkProviderStub ) ;
135+ sinon . assert . calledWith ( registerTerminalLinkProviderStub , disposableArray ) ;
136+
137+ registerTerminalLinkProviderStub . restore ( ) ;
138+ } ) ;
125139} ) ;
0 commit comments