From c4b4cee05744f97726c0dc8e537f7d9f7c09b1a3 Mon Sep 17 00:00:00 2001 From: Nora Date: Tue, 25 Oct 2022 15:42:38 +0200 Subject: [PATCH] Adjust handling of historyItem --- .../variant-analysis/workspace-query-history.json | 2 -- .../remote-queries/variant-analysis-history.test.ts | 13 +++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/extensions/ql-vscode/src/vscode-tests/no-workspace/data/variant-analysis/workspace-query-history.json b/extensions/ql-vscode/src/vscode-tests/no-workspace/data/variant-analysis/workspace-query-history.json index 88329f01d..add4195f2 100644 --- a/extensions/ql-vscode/src/vscode-tests/no-workspace/data/variant-analysis/workspace-query-history.json +++ b/extensions/ql-vscode/src/vscode-tests/no-workspace/data/variant-analysis/workspace-query-history.json @@ -5,7 +5,6 @@ "t": "variant-analysis", "status": "Completed", "completed": true, - "historyItemId": "12349821", "variantAnalysis": { "id": 98574321397, "controllerRepoId": 128321, @@ -29,7 +28,6 @@ "t": "variant-analysis", "status": "Completed", "completed": true, - "historyItemId": "12349821", "variantAnalysis": { "id": 98574321397, "controllerRepoId": 128321, diff --git a/extensions/ql-vscode/src/vscode-tests/no-workspace/remote-queries/variant-analysis-history.test.ts b/extensions/ql-vscode/src/vscode-tests/no-workspace/remote-queries/variant-analysis-history.test.ts index 349090d33..2dffcd638 100644 --- a/extensions/ql-vscode/src/vscode-tests/no-workspace/remote-queries/variant-analysis-history.test.ts +++ b/extensions/ql-vscode/src/vscode-tests/no-workspace/remote-queries/variant-analysis-history.test.ts @@ -79,7 +79,8 @@ describe('Variant Analyses and QueryHistoryManager', function() { onVariantAnalysisAdded: sandbox.stub(), onVariantAnalysisRemoved: sandbox.stub(), removeRemoteQuery: removeVariantAnalysisStub, - rehydrateVariantAnalysis: rehydrateVariantAnalysisStub + rehydrateVariantAnalysis: rehydrateVariantAnalysisStub, + onVariantAnalysisStatusUpdated: sandbox.stub() } as any as VariantAnalysisManager; rawQueryHistory = fs.readJSONSync(path.join(STORAGE_DIR, 'workspace-query-history.json')).queries; @@ -134,7 +135,7 @@ describe('Variant Analyses and QueryHistoryManager', function() { // Remove the first variant analysis await qhm.handleRemoveHistoryItem(qhm.treeDataProvider.allHistory[0]); - expect(removeVariantAnalysisStub).calledOnceWithExactly(rawQueryHistory[0].historyItemId); + expect(removeVariantAnalysisStub).calledOnceWithExactly(rawQueryHistory[0].variantAnalysis.id.toString()); expect(rehydrateVariantAnalysisStub).to.have.callCount(2); expect(rehydrateVariantAnalysisStub.getCall(0).args[0]).to.deep.eq(rawQueryHistory[0].variantAnalysis); @@ -143,7 +144,7 @@ describe('Variant Analyses and QueryHistoryManager', function() { expect(rehydrateVariantAnalysisStub.getCall(1).args[0]).to.deep.eq(rawQueryHistory[1].variantAnalysis); expect(rehydrateVariantAnalysisStub.getCall(1).args[1]).to.deep.eq(rawQueryHistory[1].status); - expect(openRemoteQueryResultsStub).calledOnceWithExactly(rawQueryHistory[1].historyItemId); + expect(openRemoteQueryResultsStub).calledOnceWithExactly(rawQueryHistory[1].variantAnalysis.id.toString()); expect(qhm.treeDataProvider.allHistory).to.deep.eq(rawQueryHistory.slice(1)); // Add it back to the history @@ -161,8 +162,8 @@ describe('Variant Analyses and QueryHistoryManager', function() { await qhm.handleRemoveHistoryItem(undefined!, [qhm.treeDataProvider.allHistory[1], qhm.treeDataProvider.allHistory[0]]); expect(removeVariantAnalysisStub.callCount).to.eq(2); - expect(removeVariantAnalysisStub.getCall(0).args[0]).to.eq(rawQueryHistory[1].historyItemId); - expect(removeVariantAnalysisStub.getCall(1).args[0]).to.eq(rawQueryHistory[0].historyItemId); + expect(removeVariantAnalysisStub.getCall(0).args[0]).to.eq(rawQueryHistory[1].variantAnalysis.id.toString()); + expect(removeVariantAnalysisStub.getCall(1).args[0]).to.eq(rawQueryHistory[0].variantAnalysis.id.toString()); expect(qhm.treeDataProvider.allHistory).to.deep.eq([]); // also, both queries should be removed from disk storage @@ -176,7 +177,7 @@ describe('Variant Analyses and QueryHistoryManager', function() { await qhm.readQueryHistory(); await qhm.handleItemClicked(qhm.treeDataProvider.allHistory[0], []); - expect(openRemoteQueryResultsStub).calledOnceWithExactly(rawQueryHistory[0].historyItemId); + expect(openRemoteQueryResultsStub).calledOnceWithExactly(rawQueryHistory[0].variantAnalysis.id.toString()); }); it('should get the query text', async () => {