@@ -27,6 +27,7 @@ suite('Openshift/Component', () => {
2727 sandbox . stub ( OdoImpl . prototype , 'getProjects' ) . resolves ( [ ] ) ;
2828 sandbox . stub ( OdoImpl . prototype , 'getApplications' ) . resolves ( [ ] ) ;
2929 sandbox . stub ( OdoImpl . prototype , 'getComponents' ) . resolves ( [ ] ) ;
30+ sandbox . stub ( Component , 'wait' ) . resolves ( ) ;
3031 } ) ;
3132
3233 teardown ( ( ) => {
@@ -37,7 +38,10 @@ suite('Openshift/Component', () => {
3738 const componentType = 'nodejs' ;
3839 const version = 'latest' ;
3940 const folder = { uri : { fsPath : 'folder' } } ;
40- let quickPickStub : sinon . SinonStub , inputStub : sinon . SinonStub , progressStub : sinon . SinonStub ;
41+ let quickPickStub : sinon . SinonStub ,
42+ inputStub : sinon . SinonStub ,
43+ progressStub : sinon . SinonStub ,
44+ progressCmdStub : sinon . SinonStub ;
4145
4246 setup ( ( ) => {
4347 quickPickStub = sandbox . stub ( vscode . window , 'showQuickPick' ) ;
@@ -46,6 +50,7 @@ suite('Openshift/Component', () => {
4650 quickPickStub . onThirdCall ( ) . resolves ( version ) ;
4751 inputStub = sandbox . stub ( vscode . window , 'showInputBox' ) ;
4852 progressStub = sandbox . stub ( Progress , 'execWithProgress' ) . resolves ( ) ;
53+ progressCmdStub = sandbox . stub ( Progress , 'execCmdWithProgress' ) . resolves ( ) ;
4954 } ) ;
5055
5156 test ( 'returns null when cancelled' , async ( ) => {
@@ -75,14 +80,13 @@ suite('Openshift/Component', () => {
7580 } ) ;
7681
7782 test ( 'happy path works' , async ( ) => {
78- const steps = [
79- { command : `odo create ${ componentType } :${ version } ${ componentItem . getName ( ) } --local ${ folder . uri . fsPath } --app ${ appItem . getName ( ) } --project ${ projectItem . getName ( ) } ` , increment : 50 } ,
80- { command : `odo push ${ componentItem . getName ( ) } --local ${ folder . uri . fsPath } --app ${ appItem . getName ( ) } --project ${ projectItem . getName ( ) } ` , increment : 50 }
81- ] ;
8283 const result = await Component . create ( appItem ) ;
8384
8485 expect ( result ) . equals ( `Component '${ componentItem . getName ( ) } ' successfully created` ) ;
85- expect ( progressStub ) . calledOnceWith ( sinon . match . object , steps ) ;
86+ expect ( progressCmdStub ) . calledOnceWith (
87+ `Creating new component '${ componentItem . getName ( ) } '` ,
88+ `odo create ${ componentType } :${ version } ${ componentItem . getName ( ) } --local ${ folder . uri . fsPath } --app ${ appItem . getName ( ) } --project ${ projectItem . getName ( ) } ` ) ;
89+ expect ( termStub ) . calledOnceWith ( `odo push ${ componentItem . getName ( ) } --local ${ folder . uri . fsPath } --app ${ appItem . getName ( ) } --project ${ projectItem . getName ( ) } ` ) ;
8690 } ) ;
8791
8892 test ( 'returns null when no folder selected' , async ( ) => {
@@ -126,13 +130,10 @@ suite('Openshift/Component', () => {
126130 } ) ;
127131
128132 test ( 'happy path works' , async ( ) => {
129- const steps = [
130- { command : `odo create ${ componentType } :${ version } ${ componentItem . getName ( ) } --git ${ uri } --app ${ appItem . getName ( ) } --project ${ projectItem . getName ( ) } ` , increment : 100 }
131- ] ;
132133 const result = await Component . create ( appItem ) ;
133134
134135 expect ( result ) . equals ( `Component '${ componentItem . getName ( ) } ' successfully created` ) ;
135- expect ( progressStub ) . calledOnceWith ( sinon . match . object , steps ) ;
136+ expect ( termStub ) . calledOnceWith ( `odo create ${ componentType } : ${ version } ${ componentItem . getName ( ) } --git ${ uri } --app ${ appItem . getName ( ) } --project ${ projectItem . getName ( ) } ` ) ;
136137 } ) ;
137138
138139 test ( 'returns null when no git repo selected' , async ( ) => {
@@ -183,13 +184,13 @@ suite('Openshift/Component', () => {
183184 } ) ;
184185
185186 test ( 'happy path works' , async ( ) => {
186- const steps = [
187- { command : `odo create ${ componentType } :${ version } ${ componentItem . getName ( ) } --binary ${ files [ 0 ] . fsPath } --app ${ appItem . getName ( ) } --project ${ projectItem . getName ( ) } ` , increment : 100 }
188- ] ;
187+
189188 const result = await Component . create ( appItem ) ;
190189
191190 expect ( result ) . equals ( `Component '${ componentItem . getName ( ) } ' successfully created` ) ;
192- expect ( progressStub ) . calledOnceWith ( sinon . match . object , steps ) ;
191+ expect ( progressCmdStub ) . calledOnceWith (
192+ `Creating new component '${ componentItem . getName ( ) } '` ,
193+ `odo create ${ componentType } :${ version } ${ componentItem . getName ( ) } --binary ${ files [ 0 ] . fsPath } --app ${ appItem . getName ( ) } --project ${ projectItem . getName ( ) } ` ) ;
193194 } ) ;
194195
195196 test ( 'returns null when no binary file selected' , async ( ) => {
0 commit comments