test: drop source-text assertion tests and merge locale checks
This commit is contained in:
1 parent
349d77d180
commit
8897e12714
257 files changed
+166
-12815
No files matched your search
-75
@@ -1,75 +0,0 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const queryStoreSource = readFileSync(new URL("../queryStore.ts", import.meta.url), "utf8");
|
||||
|
||||
/** Every direct assignment to the token, with its line number. */
|
||||
function directAssignments(): string[] {
|
||||
return queryStoreSource
|
||||
.split("\n")
|
||||
.map((line, index) => ({ line: line.trim(), number: index + 1 }))
|
||||
.filter((entry) => /^(current|tab|run)\.resultViewGeneration\s*=/.test(entry.line))
|
||||
.map((entry) => `${entry.number}: ${entry.line}`);
|
||||
}
|
||||
|
||||
/** The body of executeTabSql, where every result publication must live. */
|
||||
function executeTabSqlBody(): string {
|
||||
const start = queryStoreSource.indexOf("async function executeTabSql(");
|
||||
const end = queryStoreSource.indexOf("\n }\n", start);
|
||||
expect(start).toBeGreaterThanOrEqual(0);
|
||||
expect(end).toBeGreaterThan(start);
|
||||
return queryStoreSource.slice(start, end);
|
||||
}
|
||||
|
||||
describe("queryStore resultViewGeneration writer", () => {
|
||||
it("assigns the token in exactly the allowed places", () => {
|
||||
const assignments = directAssignments();
|
||||
|
||||
// publishResultGeneration (the writer) plus the two identity-preserving
|
||||
// readers: disk restore inherits, run projection copies the run's value.
|
||||
expect(assignments).toHaveLength(3);
|
||||
expect(assignments.join("\n")).toContain("snapshot.resultViewGeneration");
|
||||
expect(assignments.join("\n")).toContain("run.resultViewGeneration");
|
||||
});
|
||||
|
||||
it("defaults an unclassified publication to a new generation", () => {
|
||||
const start = queryStoreSource.indexOf("function publishResultGeneration(");
|
||||
const end = queryStoreSource.indexOf("function ", start + 10);
|
||||
const body = queryStoreSource.slice(start, end);
|
||||
|
||||
expect(body).toContain('if (origin === "disk-restore") return;');
|
||||
expect(body).toContain('if (origin === "append") {');
|
||||
expect(body).toContain("tab.resultViewGeneration = uuid();");
|
||||
});
|
||||
|
||||
it("publishes a generation for every replacement branch of executeTabSql", () => {
|
||||
const body = executeTabSqlBody();
|
||||
|
||||
// Generic branch: append inherits, everything else replaces.
|
||||
expect(body).toContain('publishResultGeneration(current, shouldAppendResult ? "append" : (options?.publicationOrigin ?? "execute"));');
|
||||
// Redis, MongoDB, and Elasticsearch branches replace the visible result too;
|
||||
// Mongo's append variant must keep the current generation.
|
||||
expect(body).toContain('publishResultGeneration(current, shouldAppendResult ? "append" : "execute");');
|
||||
const publicationCount = body.match(/publishResultGeneration\(current/g)?.length ?? 0;
|
||||
expect(publicationCount).toBeGreaterThanOrEqual(5);
|
||||
});
|
||||
|
||||
it("publishes outside executeTabSql where results are also replaced", () => {
|
||||
expect(queryStoreSource).toContain('publishResultGeneration(tab, "local-sort");');
|
||||
expect(queryStoreSource).toContain('publishResultGeneration(tab, "execute");');
|
||||
expect(queryStoreSource).toContain('publishResultGeneration(current, "execute");');
|
||||
});
|
||||
|
||||
it("reserves the closing tombstone for tab closure, not ordinary execution", () => {
|
||||
// Ordinary execution clears the payload before running; the tombstone there
|
||||
// would block capturing the fresh result's view for five seconds.
|
||||
const clearResultPayloadStart = queryStoreSource.indexOf("function clearResultPayload(");
|
||||
const clearResultPayloadEnd = queryStoreSource.indexOf("\n }\n", clearResultPayloadStart);
|
||||
const clearResultPayloadBody = queryStoreSource.slice(clearResultPayloadStart, clearResultPayloadEnd);
|
||||
expect(clearResultPayloadBody).not.toContain("beginClosingDataGridViewSnapshotsForTab");
|
||||
expect(clearResultPayloadBody).toContain("clearDataGridViewSnapshotsForTab(tab.id);");
|
||||
// Tab closure keeps the tombstone so the teardown capture cannot resurrect.
|
||||
expect(queryStoreSource).toContain("beginClosingDataGridViewSnapshotsForTab(id);");
|
||||
expect(queryStoreSource.match(/beginClosingDataGridViewSnapshotsForTab\(tab\.id\)/g)?.length).toBe(2);
|
||||
});
|
||||
});
|
||||
@@ -1,4 +1,3 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { createPinia, setActivePinia } from "pinia";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
@@ -12,8 +11,6 @@ const mocks = vi.hoisted(() => ({
|
||||
|
||||
vi.mock("@/lib/sqlserver/sqlServerActivityTraceRuntime", () => mocks);
|
||||
|
||||
const connectionStoreSource = readFileSync(new URL("../connectionStore.ts", import.meta.url), "utf8");
|
||||
|
||||
describe("queryStore SQL Server trace lifecycle", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
@@ -36,8 +33,4 @@ describe("queryStore SQL Server trace lifecycle", () => {
|
||||
store.closeTab(tabId);
|
||||
expect(mocks.disposeSqlServerActivityTrace).toHaveBeenCalledWith(tabId);
|
||||
});
|
||||
|
||||
it("does not scan trace sessions on ordinary connection success", () => {
|
||||
expect(connectionStoreSource).not.toContain("cleanupStaleSqlServerTraceSessions");
|
||||
});
|
||||
});
|
||||
@@ -1,4 +1,3 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { createPinia, setActivePinia } from "pinia";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
@@ -34,16 +33,3 @@ describe("queryStore createTab forceWordWrap", () => {
|
||||
expect(tab?.forceWordWrap).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Generate SQL template tabs wire forceWordWrap end to end (issue #6038)", () => {
|
||||
const sidebarSource = readFileSync(new URL("../../components/sidebar/SidebarTreeRuntimeHost.vue", import.meta.url), "utf8");
|
||||
const contentAreaSource = readFileSync(new URL("../../components/layout/ContentArea.vue", import.meta.url), "utf8");
|
||||
|
||||
it("openSqlTemplateTab requests forceWordWrap when creating the tab", () => {
|
||||
expect(sidebarSource).toMatch(/function openSqlTemplateTab\([^)]*\)\s*{[\s\S]*?createTab\([^)]*forceWordWrap:\s*true[^)]*\)/);
|
||||
});
|
||||
|
||||
it("ContentArea forwards the tab's forceWordWrap flag into QueryEditor", () => {
|
||||
expect(contentAreaSource).toMatch(/<QueryEditor[\s\S]*?:force-word-wrap="activeTab\.forceWordWrap"/);
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,4 @@
|
||||
import { createPinia, setActivePinia } from "pinia";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const saved: unknown[] = [];
|
||||
@@ -68,15 +67,6 @@ describe("settings store type color scheme persistence", () => {
|
||||
expect(last?.activeDataGridTypeColorSchemeId).toBe(SCHEME.id);
|
||||
});
|
||||
|
||||
it("stages scheme edits in the settings draft", () => {
|
||||
const dialogSource = readFileSync(new URL("../../components/editor/EditorSettingsDialog.vue", import.meta.url), "utf8");
|
||||
|
||||
expect(dialogSource).toContain("editDataGridTypeColorSchemes.value = cloneDataGridTypeColorSchemes(schemes)");
|
||||
expect(dialogSource).not.toContain("structuredClone(settingsStore.editorSettings.dataGridTypeColorSchemes)");
|
||||
expect(dialogSource).toContain("editActiveDataGridTypeColorSchemeId.value = activeId");
|
||||
expect(dialogSource).not.toMatch(/settingsStore\.updateEditorSettings\w*\(\{[^}]*DataGridTypeColorScheme/);
|
||||
});
|
||||
|
||||
it("restores a persisted scheme through normalization", async () => {
|
||||
const { normalizeEditorSettings } = await import("@/stores/settingsStore");
|
||||
|
||||
|
||||
Reference in new issue
Block a user