From a2df1eaee4f1825ecd421306d69c74455d965e17 Mon Sep 17 00:00:00 2001 From: Elena Tanasoiu Date: Thu, 19 Jan 2023 14:12:05 +0000 Subject: [PATCH 1/2] Add remote queries and variant analyses to our serialization tests This was just testing local queries. --- .../no-workspace/query-serialization.test.ts | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/extensions/ql-vscode/test/vscode-tests/no-workspace/query-serialization.test.ts b/extensions/ql-vscode/test/vscode-tests/no-workspace/query-serialization.test.ts index dfd16a165..3c5bef0e5 100644 --- a/extensions/ql-vscode/test/vscode-tests/no-workspace/query-serialization.test.ts +++ b/extensions/ql-vscode/test/vscode-tests/no-workspace/query-serialization.test.ts @@ -11,6 +11,11 @@ import { CancellationTokenSource, Uri } from "vscode"; import { tmpDir } from "../../../src/helpers"; import { QueryResultType } from "../../../src/pure/legacy-messages"; import { QueryInProgress } from "../../../src/legacy-query-server/run-queries"; +import { RemoteQueryHistoryItem } from "../../../src/remote-queries/remote-query-history-item"; +import { VariantAnalysisHistoryItem } from "../../../src/remote-queries/variant-analysis-history-item"; +import { QueryHistoryInfo } from "../../../src/query-history-info"; +import { createMockRemoteQueryHistoryItem } from "../../factories/remote-queries/remote-query-history-item"; +import { createMockVariantAnalysisHistoryItem } from "../../factories/remote-queries/variant-analysis-history-item"; describe("serialize and deserialize", () => { let infoSuccessRaw: LocalQueryInfo; @@ -18,7 +23,14 @@ describe("serialize and deserialize", () => { let infoEarlyFailure: LocalQueryInfo; let infoLateFailure: LocalQueryInfo; let infoInprogress: LocalQueryInfo; - let allHistory: LocalQueryInfo[]; + + let remoteQuery1: RemoteQueryHistoryItem; + let remoteQuery2: RemoteQueryHistoryItem; + + let variantAnalysis1: VariantAnalysisHistoryItem; + let variantAnalysis2: VariantAnalysisHistoryItem; + + let allHistory: QueryHistoryInfo[]; let queryPath: string; let cnt = 0; @@ -57,12 +69,23 @@ describe("serialize and deserialize", () => { ), ); infoInprogress = createMockFullQueryInfo("e"); + + remoteQuery1 = createMockRemoteQueryHistoryItem({}); + remoteQuery2 = createMockRemoteQueryHistoryItem({}); + + variantAnalysis1 = createMockVariantAnalysisHistoryItem({}); + variantAnalysis2 = createMockVariantAnalysisHistoryItem({}); + allHistory = [ infoSuccessRaw, infoSuccessInterpreted, infoEarlyFailure, infoLateFailure, infoInprogress, + remoteQuery1, + remoteQuery2, + variantAnalysis1, + variantAnalysis2, ]; }); @@ -72,6 +95,10 @@ describe("serialize and deserialize", () => { infoSuccessRaw, infoSuccessInterpreted, infoLateFailure, + remoteQuery1, + remoteQuery2, + variantAnalysis1, + variantAnalysis2, ]; const allHistoryPath = join(tmpDir.name, "workspace-query-history.json"); @@ -98,7 +125,7 @@ describe("serialize and deserialize", () => { } }); expectedHistory.forEach((info) => { - if (info.completedQuery) { + if (info.t == "local" && info.completedQuery) { (info.completedQuery as any).dispose = undefined; } }); From b58d82e53a1fdc1a7813e92d67ba901159cc528c Mon Sep 17 00:00:00 2001 From: Elena Tanasoiu Date: Thu, 19 Jan 2023 14:26:01 +0000 Subject: [PATCH 2/2] Fix typo --- .../vscode-tests/no-workspace/query-serialization.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/ql-vscode/test/vscode-tests/no-workspace/query-serialization.test.ts b/extensions/ql-vscode/test/vscode-tests/no-workspace/query-serialization.test.ts index 3c5bef0e5..f417e8e6d 100644 --- a/extensions/ql-vscode/test/vscode-tests/no-workspace/query-serialization.test.ts +++ b/extensions/ql-vscode/test/vscode-tests/no-workspace/query-serialization.test.ts @@ -22,7 +22,7 @@ describe("serialize and deserialize", () => { let infoSuccessInterpreted: LocalQueryInfo; let infoEarlyFailure: LocalQueryInfo; let infoLateFailure: LocalQueryInfo; - let infoInprogress: LocalQueryInfo; + let infoInProgress: LocalQueryInfo; let remoteQuery1: RemoteQueryHistoryItem; let remoteQuery2: RemoteQueryHistoryItem; @@ -68,7 +68,7 @@ describe("serialize and deserialize", () => { false, ), ); - infoInprogress = createMockFullQueryInfo("e"); + infoInProgress = createMockFullQueryInfo("e"); remoteQuery1 = createMockRemoteQueryHistoryItem({}); remoteQuery2 = createMockRemoteQueryHistoryItem({}); @@ -81,7 +81,7 @@ describe("serialize and deserialize", () => { infoSuccessInterpreted, infoEarlyFailure, infoLateFailure, - infoInprogress, + infoInProgress, remoteQuery1, remoteQuery2, variantAnalysis1,