@@ -21,17 +21,19 @@ suite('OpenShift/Application', () => {
2121 let quickPickStub : sinon . SinonStub ;
2222 let sandbox : sinon . SinonSandbox ;
2323 let execStub : sinon . SinonStub ;
24+ let getProjectsStub : sinon . SinonStub ;
2425 const clusterItem = new TestItem ( null , 'cluster' , ContextType . CLUSTER ) ;
2526 const projectItem = new TestItem ( clusterItem , 'project' , ContextType . PROJECT ) ;
2627 const appItem = new TestItem ( projectItem , 'app' , ContextType . APPLICATION ) ;
27- const compItem = new TestItem ( appItem , 'app ' , ContextType . COMPONENT_NO_CONTEXT , [ ] , null ) ;
28+ const compItem = new TestItem ( appItem , 'component ' , ContextType . COMPONENT_NO_CONTEXT , [ ] , null ) ;
2829 compItem . path = 'path/to/component' ;
2930 appItem . getChildren ( ) . push ( compItem ) ;
3031
3132 setup ( ( ) => {
3233 sandbox = sinon . createSandbox ( ) ;
3334 execStub = sandbox . stub ( OdoImpl . prototype , 'execute' ) . resolves ( { error : null , stdout : '' , stderr : '' } ) ;
3435 sandbox . stub ( OdoImpl . prototype , 'getClusters' ) . resolves ( [ clusterItem ] ) ;
36+ getProjectsStub = sandbox . stub ( OdoImpl . prototype , 'getProjects' ) . resolves ( [ projectItem ] ) ;
3537 sandbox . stub ( OdoImpl . prototype , 'getApplications' ) . resolves ( [ appItem ] ) ;
3638 sandbox . stub ( OpenShiftItem , 'getApplicationNames' ) . resolves ( [ appItem ] ) ;
3739 sandbox . stub ( vscode . window , 'showInputBox' ) ;
@@ -60,7 +62,7 @@ suite('OpenShift/Application', () => {
6062 suite ( 'called from command palette' , ( ) => {
6163
6264 test ( 'calls the appropriate error message when no project found' , async ( ) => {
63- sandbox . stub ( OdoImpl . prototype , 'getProjects' ) . resolves ( [ ] ) ;
65+ getProjectsStub . onFirstCall ( ) . resolves ( [ ] ) ;
6466 try {
6567 await Application . describe ( null ) ;
6668 } catch ( err ) {
@@ -72,7 +74,6 @@ suite('OpenShift/Application', () => {
7274 } ) ;
7375
7476 test ( 'asks to select a project and an application' , async ( ) => {
75- sandbox . stub ( OdoImpl . prototype , 'getProjects' ) . resolves ( [ projectItem ] ) ;
7677 const apps = [ appItem ] ;
7778 quickPickStub = sandbox . stub ( vscode . window , 'showQuickPick' ) ;
7879 quickPickStub . onFirstCall ( ) . resolves ( appItem ) ;
@@ -83,7 +84,6 @@ suite('OpenShift/Application', () => {
8384 } ) ;
8485
8586 test ( 'skips odo command execution if canceled by user' , async ( ) => {
86- sandbox . stub ( OdoImpl . prototype , 'getProjects' ) . resolves ( [ projectItem ] ) ;
8787 quickPickStub = sandbox . stub ( vscode . window , 'showQuickPick' ) . resolves ( null ) ;
8888 await Application . describe ( null ) ;
8989 expect ( termStub ) . not . called ;
@@ -96,16 +96,17 @@ suite('OpenShift/Application', () => {
9696
9797 setup ( ( ) => {
9898 warnStub = sandbox . stub ( vscode . window , 'showWarningMessage' ) ;
99- sandbox . stub ( OdoImpl . prototype , 'getProjects' ) . resolves ( [ projectItem ] ) ;
100- sandbox . stub ( OdoImpl . prototype , 'getComponents' ) . resolves ( [ compItem ] ) ;
99+ getProjectsStub . onFirstCall ( ) . resolves ( [ projectItem ] ) ;
100+ const pushedCompItem = new TestItem ( appItem , 'app' , ContextType . COMPONENT_PUSHED , [ ] ) ;
101+ sandbox . stub ( OdoImpl . prototype , 'getApplicationChildren' ) . resolves ( [ pushedCompItem ] ) ;
101102 } ) ;
102103
103104 test ( 'calls the appropriate odo command if confirmed' , async ( ) => {
104105 warnStub . resolves ( 'Yes' ) ;
105106
106107 await Application . del ( appItem ) ;
107108
108- expect ( execStub ) . calledOnceWith ( Command . deleteApplication ( projectItem . getName ( ) , appItem . getName ( ) ) ) ;
109+ expect ( execStub ) . calledWith ( Command . deleteApplication ( projectItem . getName ( ) , appItem . getName ( ) ) ) ;
109110 } ) ;
110111
111112 test ( 'returns a confirmation message text when successful' , async ( ) => {
0 commit comments