@@ -10,11 +10,14 @@ import * as sinon from 'sinon';
1010import * as chai from 'chai' ;
1111import * as sinonChai from 'sinon-chai' ;
1212import { ToolsConfig } from '../src/tools' ;
13+ import { WindowUtil } from '../src/util/windowUtils' ;
1314import { window } from 'vscode' ;
15+ import { Terminal } from 'vscode' ;
1416import jsYaml = require( 'js-yaml' ) ;
1517import { TestItem } from './openshift/testOSItem' ;
1618import { ExecException } from 'child_process' ;
1719import * as fs from 'fs' ;
20+ import * as path from 'path' ;
1821
1922const expect = chai . expect ;
2023chai . use ( sinonChai ) ;
@@ -86,6 +89,24 @@ suite("odo", () => {
8689
8790 expect ( result ) . deep . equals ( { error : err , stdout : '' , stderr : '' } ) ;
8891 } ) ;
92+
93+ test ( 'executeInTerminal send command to terminal and shows it' , async ( ) => {
94+ const termFake : Terminal = {
95+ name : "name" ,
96+ processId : Promise . resolve ( 1 ) ,
97+ sendText : sinon . stub ( ) ,
98+ show : sinon . stub ( ) ,
99+ hide : sinon . stub ( ) ,
100+ dispose : sinon . stub ( )
101+ } ;
102+ toolsStub . restore ( ) ;
103+ toolsStub = sandbox . stub ( ToolsConfig , 'detectOrDownload' ) . resolves ( path . join ( 'segment1' , 'segment2' ) ) ;
104+ let ctStub = sandbox . stub ( WindowUtil , 'createTerminal' ) . returns ( termFake ) ;
105+ await odoCli . executeInTerminal ( 'cmd' ) ;
106+ expect ( termFake . sendText ) . calledOnce ;
107+ expect ( termFake . show ) . calledOnce ;
108+ expect ( ctStub ) . calledWith ( 'OpenShift' , process . cwd ( ) , 'segment1' ) ;
109+ } ) ;
89110 } ) ;
90111
91112 suite ( 'item listings' , ( ) => {
0 commit comments