mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-20 18:27:36 +00:00
Co-authored-by: SuLe <sule@SuLedeMacBook-Air.local> Co-authored-by: skyler <77960507+t8y2@users.noreply.github.com>
16 lines
897 B
TypeScript
16 lines
897 B
TypeScript
import { strict as assert } from "node:assert";
|
|
import test from "node:test";
|
|
import { canCancelQueryExecution, queryExecutionLabelKey } from "../src/lib/queryExecutionState.ts";
|
|
|
|
test("only allows cancelling an active execution with an execution id", () => {
|
|
assert.equal(canCancelQueryExecution({ isExecuting: true, executionId: "exec-1" }), true);
|
|
assert.equal(canCancelQueryExecution({ isExecuting: true, executionId: "exec-1", isCancelling: true }), false);
|
|
assert.equal(canCancelQueryExecution({ isExecuting: true }), false);
|
|
assert.equal(canCancelQueryExecution({ isExecuting: false, executionId: "exec-1" }), false);
|
|
});
|
|
|
|
test("uses a stopping label while cancellation is in progress", () => {
|
|
assert.equal(queryExecutionLabelKey({ isExecuting: true }), "common.loading");
|
|
assert.equal(queryExecutionLabelKey({ isExecuting: true, isCancelling: true }), "common.stopping");
|
|
});
|