1 parent
c27a4dd83d
commit
143143a88d
9 files changed
+111
-12
No files matched your search
@@ -13,6 +13,8 @@ const mocks = vi.hoisted(() => ({
|
||||
getConnectionConfig: vi.fn(),
|
||||
prepareQueryPaginationExecutionPlan: vi.fn(),
|
||||
saveOpenTabsState: vi.fn(),
|
||||
clearDataGridPendingSnapshot: vi.fn(),
|
||||
clearDataGridPendingSnapshotsForTab: vi.fn(),
|
||||
tabResultSnapshots: new Map<string, unknown>(),
|
||||
}));
|
||||
|
||||
@@ -42,6 +44,11 @@ vi.mock("@/stores/settingsStore", () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock("@/composables/useDataGridEditor", () => ({
|
||||
clearDataGridPendingSnapshot: mocks.clearDataGridPendingSnapshot,
|
||||
clearDataGridPendingSnapshotsForTab: mocks.clearDataGridPendingSnapshotsForTab,
|
||||
}));
|
||||
|
||||
vi.mock("@/lib/tabs/tabResultCache", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("@/lib/tabs/tabResultCache")>();
|
||||
return {
|
||||
@@ -630,6 +637,12 @@ describe("queryStore multi-statement errors", () => {
|
||||
expect(tab.resultAutoSave).toBeUndefined();
|
||||
expect(tab.resultRuns).toHaveLength(2);
|
||||
expect(tab.activeResultRunId).toBe(tab.resultRuns?.[1]?.id);
|
||||
const firstRunRevision = tab.resultRuns?.[0]?.resultGridRevision;
|
||||
const secondRunRevision = tab.resultRuns?.[1]?.resultGridRevision;
|
||||
expect(firstRunRevision).toBeTruthy();
|
||||
expect(secondRunRevision).toBeTruthy();
|
||||
expect(secondRunRevision).not.toBe(firstRunRevision);
|
||||
expect(mocks.clearDataGridPendingSnapshot).toHaveBeenCalledTimes(1);
|
||||
|
||||
expect(await store.setActiveResultRun(tabId, tab.resultRuns![0]!.id)).toBe(true);
|
||||
expect(tab.result?.rows[0]?.[0]).toBe(1);
|
||||
@@ -640,6 +653,9 @@ describe("queryStore multi-statement errors", () => {
|
||||
|
||||
expect(tab.resultRuns).toHaveLength(2);
|
||||
expect(tab.activeResultRunId).toBe(tab.resultRuns?.[1]?.id);
|
||||
expect(tab.resultGridRevision).toBe(tab.resultRuns?.[1]?.resultGridRevision);
|
||||
expect(tab.resultGridRevision).not.toBe(secondRunRevision);
|
||||
expect(mocks.clearDataGridPendingSnapshot).toHaveBeenCalledTimes(2);
|
||||
expect(await store.setActiveResultRun(tabId, tab.resultRuns![0]!.id)).toBe(true);
|
||||
expect(tab.result?.rows[0]?.[0]).toBe(1);
|
||||
expect(await store.setActiveResultRun(tabId, tab.resultRuns![1]!.id)).toBe(true);
|
||||
|
||||
Reference in new issue
Block a user