Remove formatLegacyMessage
This commit is contained in:
Родитель
ef575acd59
Коммит
d0f122ad87
|
@ -1,23 +0,0 @@
|
|||
import * as legacyMessages from "./legacy-messages";
|
||||
|
||||
// Used for formatting the result of a legacy query which might still be in the
|
||||
// user's query history.
|
||||
export function formatLegacyMessage(result: legacyMessages.EvaluationResult) {
|
||||
switch (result.resultType) {
|
||||
case legacyMessages.QueryResultType.CANCELLATION:
|
||||
return `cancelled after ${Math.round(
|
||||
result.evaluationTime / 1000,
|
||||
)} seconds`;
|
||||
case legacyMessages.QueryResultType.OOM:
|
||||
return "out of memory";
|
||||
case legacyMessages.QueryResultType.SUCCESS:
|
||||
return `finished in ${Math.round(result.evaluationTime / 1000)} seconds`;
|
||||
case legacyMessages.QueryResultType.TIMEOUT:
|
||||
return `timed out after ${Math.round(
|
||||
result.evaluationTime / 1000,
|
||||
)} seconds`;
|
||||
case legacyMessages.QueryResultType.OTHER_ERROR:
|
||||
default:
|
||||
return result.message ? `failed: ${result.message}` : "failed";
|
||||
}
|
||||
}
|
|
@ -25,13 +25,8 @@ import {
|
|||
import { CodeQLCliServer, SourceInfo } from "../../../src/codeql-cli/cli";
|
||||
import { CancellationTokenSource, Uri } from "vscode";
|
||||
import { tmpDir } from "../../../src/tmp-dir";
|
||||
import {
|
||||
EvaluationResult,
|
||||
QueryResultType,
|
||||
} from "../../../src/query-server/legacy-messages";
|
||||
import { sleep } from "../../../src/common/time";
|
||||
import { mockedObject } from "../utils/mocking.helpers";
|
||||
import { formatLegacyMessage } from "../../../src/query-server/format-legacy-message";
|
||||
|
||||
describe("query-results", () => {
|
||||
let queryPath: string;
|
||||
|
@ -106,33 +101,6 @@ describe("query-results", () => {
|
|||
expect(completedQuery.getResultsPath("zxa")).toBe("bxa");
|
||||
});
|
||||
|
||||
it("should format the statusString", () => {
|
||||
const evalResult: EvaluationResult = {
|
||||
resultType: QueryResultType.OTHER_ERROR,
|
||||
evaluationTime: 12340,
|
||||
queryId: 3,
|
||||
runId: 1,
|
||||
};
|
||||
|
||||
evalResult.message = "Tremendously";
|
||||
expect(formatLegacyMessage(evalResult)).toBe("failed: Tremendously");
|
||||
|
||||
evalResult.resultType = QueryResultType.OTHER_ERROR;
|
||||
expect(formatLegacyMessage(evalResult)).toBe("failed: Tremendously");
|
||||
|
||||
evalResult.resultType = QueryResultType.CANCELLATION;
|
||||
evalResult.evaluationTime = 2345;
|
||||
expect(formatLegacyMessage(evalResult)).toBe("cancelled after 2 seconds");
|
||||
|
||||
evalResult.resultType = QueryResultType.OOM;
|
||||
expect(formatLegacyMessage(evalResult)).toBe("out of memory");
|
||||
|
||||
evalResult.resultType = QueryResultType.SUCCESS;
|
||||
expect(formatLegacyMessage(evalResult)).toBe("finished in 2 seconds");
|
||||
|
||||
evalResult.resultType = QueryResultType.TIMEOUT;
|
||||
expect(formatLegacyMessage(evalResult)).toBe("timed out after 2 seconds");
|
||||
});
|
||||
it("should updateSortState", async () => {
|
||||
// setup
|
||||
const fqi = createMockFullQueryInfo(
|
||||
|
|
Загрузка…
Ссылка в новой задаче