Skip to content

Commit

Permalink
Added unittest for watch method (#597)
Browse files Browse the repository at this point in the history
* Added unittest for watch method
  • Loading branch information
sudhirverma authored Feb 4, 2019
1 parent 8deac1b commit 21c6be8
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion test/openshift/component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as chai from 'chai';
import * as sinonChai from 'sinon-chai';
import * as sinon from 'sinon';
import { TestItem } from './testOSItem';
import { OdoImpl } from '../../src/odo';
import { OdoImpl, Command } from '../../src/odo';
import { Component } from '../../src/openshift/component';
import { Progress } from '../../src/util/progress';
import { OpenShiftItem } from '../../src/openshift/openshiftItem';
Expand Down Expand Up @@ -727,4 +727,26 @@ suite('Openshift/Component', () => {
expect(termStub).calledOnceWith(`odo push ${componentItem.getName()} --app ${appItem.getName()} --project ${projectItem.getName()}`);
});
});

suite('watch', () => {

setup(() => {
quickPickStub = sandbox.stub(vscode.window, 'showQuickPick');
quickPickStub.onFirstCall().resolves(projectItem);
quickPickStub.onSecondCall().resolves(appItem);
quickPickStub.onThirdCall().resolves(componentItem);
});

test('calls the correct odo command w/ context', async () => {
await Component.watch(componentItem);

expect(termStub).calledOnceWith(Command.watchComponent(projectItem.getName(), appItem.getName(), componentItem.getName()));
});

test('calls the correct odo command w/o context', async () => {
await Component.watch(null);

expect(termStub).calledOnceWith(Command.watchComponent(projectItem.getName(), appItem.getName(), componentItem.getName()));
});
});
});

0 comments on commit 21c6be8

Please sign in to comment.