@@ -189,7 +189,7 @@ suite('Terminal Service', () => {
189189 terminal . verify ( ( t ) => t . sendText ( TypeMoq . It . isValue ( textToSend ) ) , TypeMoq . Times . exactly ( 1 ) ) ;
190190 } ) ;
191191
192- // Ensure sendText is called when Python shell integration is disabled.
192+ // Ensure sendText is called when Python shell integration are disabled.
193193 test ( 'Ensure text is sent to terminal and it is shown when Python shell integration is disabled' , async ( ) => {
194194 pythonConfig
195195 . setup ( ( p ) => p . get ( 'terminal.shellIntegration.enabled' ) )
@@ -211,12 +211,48 @@ suite('Terminal Service', () => {
211211 terminal . verify ( ( t ) => t . sendText ( TypeMoq . It . isValue ( textToSend ) ) , TypeMoq . Times . exactly ( 1 ) ) ;
212212 } ) ;
213213
214+ // Ensure sendText is called when terminal.shellIntegration is enabled but Python shell integration is disabled
215+ test ( 'Ensure sendText is called when terminal.shellIntegration enabled but Python shell integration disabled' , async ( ) => {
216+ pythonConfig
217+ . setup ( ( p ) => p . get ( 'terminal.shellIntegration.enabled' ) )
218+ . returns ( ( ) => false )
219+ . verifiable ( TypeMoq . Times . once ( ) ) ;
220+
221+ terminalHelper
222+ . setup ( ( helper ) => helper . getEnvironmentActivationCommands ( TypeMoq . It . isAny ( ) , TypeMoq . It . isAny ( ) ) )
223+ . returns ( ( ) => Promise . resolve ( undefined ) ) ;
224+ service = new TerminalService ( mockServiceContainer . object ) ;
225+ const textToSend = 'Some Text' ;
226+ terminalHelper . setup ( ( h ) => h . identifyTerminalShell ( TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => TerminalShellType . bash ) ;
227+ terminalManager . setup ( ( t ) => t . createTerminal ( TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => terminal . object ) ;
228+
229+ service . ensureTerminal ( ) ;
230+ service . executeCommand ( textToSend , true ) ;
231+
232+ terminal . verify ( ( t ) => t . show ( TypeMoq . It . isValue ( true ) ) , TypeMoq . Times . exactly ( 1 ) ) ;
233+ terminal . verify ( ( t ) => t . sendText ( TypeMoq . It . isValue ( textToSend ) ) , TypeMoq . Times . exactly ( 1 ) ) ;
234+ } ) ;
235+
214236 // Ensure executeCommand is called when Python shell integration and terminal shell integration are both enabled
215- test ( 'Ensure executeCommand is called when Python shell integration and terminal shell integration are both enabled' , async ( ) => {
237+ test ( 'Ensure sendText is not called when Python shell integration and terminal shell integration are both enabled' , async ( ) => {
216238 pythonConfig
217239 . setup ( ( p ) => p . get ( 'terminal.shellIntegration.enabled' ) )
218240 . returns ( ( ) => true )
219241 . verifiable ( TypeMoq . Times . once ( ) ) ;
242+
243+ terminalHelper
244+ . setup ( ( helper ) => helper . getEnvironmentActivationCommands ( TypeMoq . It . isAny ( ) , TypeMoq . It . isAny ( ) ) )
245+ . returns ( ( ) => Promise . resolve ( undefined ) ) ;
246+ service = new TerminalService ( mockServiceContainer . object ) ;
247+ const textToSend = 'Some Text' ;
248+ terminalHelper . setup ( ( h ) => h . identifyTerminalShell ( TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => TerminalShellType . bash ) ;
249+ terminalManager . setup ( ( t ) => t . createTerminal ( TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => terminal . object ) ;
250+
251+ service . ensureTerminal ( ) ;
252+ service . executeCommand ( textToSend , true ) ;
253+
254+ terminal . verify ( ( t ) => t . show ( TypeMoq . It . isValue ( true ) ) , TypeMoq . Times . exactly ( 1 ) ) ;
255+ terminal . verify ( ( t ) => t . sendText ( TypeMoq . It . isValue ( textToSend ) ) , TypeMoq . Times . never ( ) ) ;
220256 } ) ;
221257
222258 test ( 'Ensure terminal is not shown if `hideFromUser` option is set to `true`' , async ( ) => {
0 commit comments