Skip to content

Commit 21c6be8

Browse files
authored
Added unittest for watch method (#597)
* Added unittest for watch method
1 parent 8deac1b commit 21c6be8

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

test/openshift/component.test.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as chai from 'chai';
1010
import * as sinonChai from 'sinon-chai';
1111
import * as sinon from 'sinon';
1212
import { TestItem } from './testOSItem';
13-
import { OdoImpl } from '../../src/odo';
13+
import { OdoImpl, Command } from '../../src/odo';
1414
import { Component } from '../../src/openshift/component';
1515
import { Progress } from '../../src/util/progress';
1616
import { OpenShiftItem } from '../../src/openshift/openshiftItem';
@@ -727,4 +727,26 @@ suite('Openshift/Component', () => {
727727
expect(termStub).calledOnceWith(`odo push ${componentItem.getName()} --app ${appItem.getName()} --project ${projectItem.getName()}`);
728728
});
729729
});
730+
731+
suite('watch', () => {
732+
733+
setup(() => {
734+
quickPickStub = sandbox.stub(vscode.window, 'showQuickPick');
735+
quickPickStub.onFirstCall().resolves(projectItem);
736+
quickPickStub.onSecondCall().resolves(appItem);
737+
quickPickStub.onThirdCall().resolves(componentItem);
738+
});
739+
740+
test('calls the correct odo command w/ context', async () => {
741+
await Component.watch(componentItem);
742+
743+
expect(termStub).calledOnceWith(Command.watchComponent(projectItem.getName(), appItem.getName(), componentItem.getName()));
744+
});
745+
746+
test('calls the correct odo command w/o context', async () => {
747+
await Component.watch(null);
748+
749+
expect(termStub).calledOnceWith(Command.watchComponent(projectItem.getName(), appItem.getName(), componentItem.getName()));
750+
});
751+
});
730752
});

0 commit comments

Comments
 (0)