Skip to content

Commit c4b4cee

Browse files
norascheuchelenatanasoiu
authored andcommitted
Adjust handling of historyItem
1 parent 7cffb99 commit c4b4cee

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

extensions/ql-vscode/src/vscode-tests/no-workspace/data/variant-analysis/workspace-query-history.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"t": "variant-analysis",
66
"status": "Completed",
77
"completed": true,
8-
"historyItemId": "12349821",
98
"variantAnalysis": {
109
"id": 98574321397,
1110
"controllerRepoId": 128321,
@@ -29,7 +28,6 @@
2928
"t": "variant-analysis",
3029
"status": "Completed",
3130
"completed": true,
32-
"historyItemId": "12349821",
3331
"variantAnalysis": {
3432
"id": 98574321397,
3533
"controllerRepoId": 128321,

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ describe('Variant Analyses and QueryHistoryManager', function() {
7979
onVariantAnalysisAdded: sandbox.stub(),
8080
onVariantAnalysisRemoved: sandbox.stub(),
8181
removeRemoteQuery: removeVariantAnalysisStub,
82-
rehydrateVariantAnalysis: rehydrateVariantAnalysisStub
82+
rehydrateVariantAnalysis: rehydrateVariantAnalysisStub,
83+
onVariantAnalysisStatusUpdated: sandbox.stub()
8384
} as any as VariantAnalysisManager;
8485

8586
rawQueryHistory = fs.readJSONSync(path.join(STORAGE_DIR, 'workspace-query-history.json')).queries;
@@ -134,7 +135,7 @@ describe('Variant Analyses and QueryHistoryManager', function() {
134135
// Remove the first variant analysis
135136
await qhm.handleRemoveHistoryItem(qhm.treeDataProvider.allHistory[0]);
136137

137-
expect(removeVariantAnalysisStub).calledOnceWithExactly(rawQueryHistory[0].historyItemId);
138+
expect(removeVariantAnalysisStub).calledOnceWithExactly(rawQueryHistory[0].variantAnalysis.id.toString());
138139
expect(rehydrateVariantAnalysisStub).to.have.callCount(2);
139140

140141
expect(rehydrateVariantAnalysisStub.getCall(0).args[0]).to.deep.eq(rawQueryHistory[0].variantAnalysis);
@@ -143,7 +144,7 @@ describe('Variant Analyses and QueryHistoryManager', function() {
143144
expect(rehydrateVariantAnalysisStub.getCall(1).args[0]).to.deep.eq(rawQueryHistory[1].variantAnalysis);
144145
expect(rehydrateVariantAnalysisStub.getCall(1).args[1]).to.deep.eq(rawQueryHistory[1].status);
145146

146-
expect(openRemoteQueryResultsStub).calledOnceWithExactly(rawQueryHistory[1].historyItemId);
147+
expect(openRemoteQueryResultsStub).calledOnceWithExactly(rawQueryHistory[1].variantAnalysis.id.toString());
147148
expect(qhm.treeDataProvider.allHistory).to.deep.eq(rawQueryHistory.slice(1));
148149

149150
// Add it back to the history
@@ -161,8 +162,8 @@ describe('Variant Analyses and QueryHistoryManager', function() {
161162
await qhm.handleRemoveHistoryItem(undefined!, [qhm.treeDataProvider.allHistory[1], qhm.treeDataProvider.allHistory[0]]);
162163

163164
expect(removeVariantAnalysisStub.callCount).to.eq(2);
164-
expect(removeVariantAnalysisStub.getCall(0).args[0]).to.eq(rawQueryHistory[1].historyItemId);
165-
expect(removeVariantAnalysisStub.getCall(1).args[0]).to.eq(rawQueryHistory[0].historyItemId);
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());
166167
expect(qhm.treeDataProvider.allHistory).to.deep.eq([]);
167168

168169
// also, both queries should be removed from disk storage
@@ -176,7 +177,7 @@ describe('Variant Analyses and QueryHistoryManager', function() {
176177
await qhm.readQueryHistory();
177178

178179
await qhm.handleItemClicked(qhm.treeDataProvider.allHistory[0], []);
179-
expect(openRemoteQueryResultsStub).calledOnceWithExactly(rawQueryHistory[0].historyItemId);
180+
expect(openRemoteQueryResultsStub).calledOnceWithExactly(rawQueryHistory[0].variantAnalysis.id.toString());
180181
});
181182

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

0 commit comments

Comments
 (0)