21 lines
812 B
TypeScript
21 lines
812 B
TypeScript
import { strict as assert } from "node:assert";
|
|
import test from "node:test";
|
|
import { createPinia, setActivePinia } from "pinia";
|
|
import { useQueryStore } from "../../src/stores/queryStore.ts";
|
|
|
|
test("setErrorResult stops loading and shows the error result", () => {
|
|
setActivePinia(createPinia());
|
|
const store = useQueryStore();
|
|
const tabId = store.createTab("conn-1", "db", "users", "data");
|
|
|
|
store.setExecuting(tabId, true);
|
|
store.setErrorResult(tabId, new Error("metadata failed"));
|
|
|
|
const tab = store.tabs.find((item) => item.id === tabId);
|
|
assert.equal(tab?.isExecuting, false);
|
|
assert.equal(tab?.isCancelling, false);
|
|
assert.equal(tab?.executionId, undefined);
|
|
assert.deepEqual(tab?.result?.columns, ["Error"]);
|
|
assert.deepEqual(tab?.result?.rows, [["Error: metadata failed"]]);
|
|
});
|