Skip to content

Commit ad7a04e

Browse files
committed
Update tests to account for item removal and showView
We've merged #1656 which actually implements item removal. We'll need to change our tests to account for this. We've also merged #1654 which implements opening the view when we click on a variant analysis history item. So we've changed our tests to take into account that there's now a `showView` method being called.
1 parent c4b4cee commit ad7a04e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

extensions/ql-vscode/src/vscode-tests/no-workspace/remote-queries/variant-analysis-history.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ describe('Variant Analyses and QueryHistoryManager', function() {
4747
let openRemoteQueryResultsStub: sinon.SinonStub;
4848
let rehydrateVariantAnalysisStub: sinon.SinonStub;
4949
let removeVariantAnalysisStub: sinon.SinonStub;
50+
let showViewStub: sinon.SinonStub;
5051

5152
beforeEach(async function() {
5253
// set a higher timeout since recursive delete below may take a while, expecially on Windows.
@@ -78,9 +79,10 @@ describe('Variant Analyses and QueryHistoryManager', function() {
7879
variantAnalysisManagerStub = {
7980
onVariantAnalysisAdded: sandbox.stub(),
8081
onVariantAnalysisRemoved: sandbox.stub(),
81-
removeRemoteQuery: removeVariantAnalysisStub,
82+
removeVariantAnalysis: removeVariantAnalysisStub,
8283
rehydrateVariantAnalysis: rehydrateVariantAnalysisStub,
83-
onVariantAnalysisStatusUpdated: sandbox.stub()
84+
onVariantAnalysisStatusUpdated: sandbox.stub(),
85+
showView: showViewStub
8486
} as any as VariantAnalysisManager;
8587

8688
rawQueryHistory = fs.readJSONSync(path.join(STORAGE_DIR, 'workspace-query-history.json')).queries;
@@ -162,8 +164,8 @@ describe('Variant Analyses and QueryHistoryManager', function() {
162164
await qhm.handleRemoveHistoryItem(undefined!, [qhm.treeDataProvider.allHistory[1], qhm.treeDataProvider.allHistory[0]]);
163165

164166
expect(removeVariantAnalysisStub.callCount).to.eq(2);
165-
expect(removeVariantAnalysisStub.getCall(0).args[0]).to.eq(rawQueryHistory[1].variantAnalysis.id.toString());
166-
expect(removeVariantAnalysisStub.getCall(1).args[0]).to.eq(rawQueryHistory[0].variantAnalysis.id.toString());
167+
expect(removeVariantAnalysisStub.getCall(0).args[0]).to.eq(rawQueryHistory[1].variantAnalysis);
168+
expect(removeVariantAnalysisStub.getCall(1).args[0]).to.eq(rawQueryHistory[0].variantAnalysis);
167169
expect(qhm.treeDataProvider.allHistory).to.deep.eq([]);
168170

169171
// also, both queries should be removed from disk storage
@@ -177,7 +179,7 @@ describe('Variant Analyses and QueryHistoryManager', function() {
177179
await qhm.readQueryHistory();
178180

179181
await qhm.handleItemClicked(qhm.treeDataProvider.allHistory[0], []);
180-
expect(openRemoteQueryResultsStub).calledOnceWithExactly(rawQueryHistory[0].variantAnalysis.id.toString());
182+
expect(showViewStub).calledOnceWithExactly(rawQueryHistory[0].variantAnalysis.id.toString());
181183
});
182184

183185
it('should get the query text', async () => {

0 commit comments

Comments
 (0)