Skip to content

Commit 1a03c0e

Browse files
committed
Attempt to fix tests
1 parent a8c54b7 commit 1a03c0e

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

extensions/ql-vscode/src/vscode-tests/no-workspace/remote-queries/repository-selection.test.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as sinon from 'sinon';
33
import { expect } from 'chai';
44
import { window } from 'vscode';
55
import * as pq from 'proxyquire';
6+
import { UserCancellationException } from '../../../commandRunner';
67

78
const proxyquire = pq.noPreserveCache();
89

@@ -13,21 +14,16 @@ describe('repository-selection', function() {
1314
let quickPickSpy: sinon.SinonStub;
1415
let showInputBoxSpy: sinon.SinonStub;
1516
let getRemoteRepositoryListsSpy: sinon.SinonStub;
16-
let showAndLogErrorMessageSpy: sinon.SinonStub;
1717
let mod: any;
1818
beforeEach(() => {
1919
sandbox = sinon.createSandbox();
2020
quickPickSpy = sandbox.stub(window, 'showQuickPick');
2121
showInputBoxSpy = sandbox.stub(window, 'showInputBox');
2222
getRemoteRepositoryListsSpy = sandbox.stub();
23-
showAndLogErrorMessageSpy = sandbox.stub();
2423
mod = proxyquire('../../../remote-queries/repository-selection', {
2524
'../config': {
2625
getRemoteRepositoryLists: getRemoteRepositoryListsSpy
2726
},
28-
'../helpers': {
29-
showAndLogErrorMessage: showAndLogErrorMessageSpy
30-
},
3127
});
3228
});
3329

@@ -120,11 +116,8 @@ describe('repository-selection', function() {
120116
getRemoteRepositoryListsSpy.returns({}); // no pre-defined repo lists
121117
showInputBoxSpy.resolves(repo);
122118

123-
// make the function call
124-
await mod.getRepositorySelection();
125-
126-
// check that we get the right error message
127-
expect(showAndLogErrorMessageSpy.firstCall.args[0]).to.contain('Invalid repository format');
119+
// function call should throw a UserCancellationException
120+
await expect(mod.getRepositorySelection()).to.be.rejectedWith(UserCancellationException, 'Invalid repository format');
128121
});
129122
});
130123

0 commit comments

Comments
 (0)