Skip to content

Commit 8f56c20

Browse files
committed
Fix Vue 3 / VTU v2 patterns in tests and stores
- historyStore: replace Vue 2 set()/del() with direct property assignment / delete operator. del() was undefined and threw at runtime in tests. - Test files: replace wrapper.destroy() with wrapper.unmount() for Vue Test Utils v2. - Test files: add explicit describe/it/expect imports where missing (vitest globals are disabled). Addresses ~30 of the remaining test failures (delete operator, VTU v2 unmount API, missing vitest globals). Heading slot rendering and BootstrapVue compat-mode issues still account for the bulk of the remaining failures.
1 parent 0d75e35 commit 8f56c20

12 files changed

Lines changed: 20 additions & 17 deletions

File tree

client/src/components/Common/PersistentTaskProgressMonitorAlert.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { shallowMount } from "@vue/test-utils";
2-
import { vi } from "vitest";
2+
import { beforeEach, describe, expect, it, vi } from "vitest";
33
import { ref } from "vue";
44

55
import type { TaskMonitor } from "@/composables/genericTaskMonitor";

client/src/components/Common/RenameModal.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe("RenameModal tested for renaming workflows", () => {
7575
expect(wrapper.emitted("close")).toBeTruthy();
7676

7777
// Simulate parent closing and reopening the modal (destroys old instance)
78-
wrapper.destroy();
78+
wrapper.unmount();
7979
await mountRenameModal();
8080
expect((createWrapper(document.body).find("#workflow-name-input").element as HTMLInputElement).value).toBe(
8181
WORKFLOW_NAME,

client/src/components/Common/VegaWrapper.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe("VegaWrapper", () => {
6363
propsData: { spec: defaultSpec },
6464
});
6565
await flushPromises();
66-
wrapper.destroy();
66+
wrapper.unmount();
6767

6868
expect(mockFinalize).toHaveBeenCalled();
6969
});

client/src/components/ConfirmDialog.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe("ConfirmDialog", () => {
1616

1717
afterEach(() => {
1818
setConfirmDialogComponentRef(null);
19-
wrapper.destroy();
19+
wrapper.unmount();
2020
document.body.innerHTML = "";
2121
});
2222

client/src/components/Form/Elements/FormData/FormData.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import "@/composables/__mocks__/filter";
44
import { createTestingPinia } from "@pinia/testing";
55
import { dispatchEvent, getLocalVue } from "@tests/vitest/helpers";
66
import { mount } from "@vue/test-utils";
7+
import { describe, expect, it } from "vitest";
78

89
import { testDatatypesMapper } from "@/components/Datatypes/test_fixtures";
910
import { useDatatypesMapperStore } from "@/stores/datatypesMapperStore";

client/src/components/Form/Elements/FormNumber.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ describe("FormNumber", () => {
2222
const wrapperFloat = await mountFormNumber({ value: 1, type: "float" });
2323
const inputFloat = await getInput(wrapperFloat);
2424
expect(inputFloat.exists()).toBe(true);
25-
wrapperFloat.destroy();
25+
wrapperFloat.unmount();
2626

2727
const wrapperInteger = await mountFormNumber({ value: 1, type: "integer" });
2828
const inputInteger = await getInput(wrapperInteger);
2929
expect(inputInteger.exists()).toBe(true);
30-
wrapperInteger.destroy();
30+
wrapperInteger.unmount();
3131
});
3232

3333
it("renders a range input only when both min and max are defined and max > min", async () => {
@@ -114,7 +114,7 @@ describe("FormNumber", () => {
114114
});
115115

116116
expect(preventDefaultInteger).toHaveBeenCalled();
117-
integerWrapper.destroy();
117+
integerWrapper.unmount();
118118
});
119119

120120
it("allows '.' for float type", async () => {
@@ -128,7 +128,7 @@ describe("FormNumber", () => {
128128
});
129129

130130
expect(preventDefaultFloat).not.toHaveBeenCalled();
131-
floatWrapper.destroy();
131+
floatWrapper.unmount();
132132
});
133133

134134
it("allows typing '-' when negative numbers are permitted", async () => {
@@ -143,7 +143,7 @@ describe("FormNumber", () => {
143143
});
144144

145145
expect(preventDefault).not.toHaveBeenCalled();
146-
wrapper.destroy();
146+
wrapper.unmount();
147147
});
148148

149149
it("blocks typing '-' when min is non-negative", async () => {
@@ -158,7 +158,7 @@ describe("FormNumber", () => {
158158
});
159159

160160
expect(preventDefault).toHaveBeenCalled();
161-
wrapper.destroy();
161+
wrapper.unmount();
162162
});
163163

164164
it("computes the correct step value based on float precision", async () => {

client/src/components/Form/Elements/FormSelectMany/FormSelectMany.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import "./worker/__mocks__/selectMany";
33
import { createTestingPinia } from "@pinia/testing";
44
import { getLocalVue } from "@tests/vitest/helpers";
55
import { mount } from "@vue/test-utils";
6+
import { describe, expect, it } from "vitest";
67

78
import type { SelectOption } from "./worker/selectMany";
89

client/src/components/ObjectStore/ObjectStoreBadge.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { getLocalVue } from "@tests/vitest/helpers";
22
import { mount, type Wrapper } from "@vue/test-utils";
3+
import { describe, expect, it } from "vitest";
34

45
import type { ObjectStoreBadgeType } from "@/api/objectStores.templates";
56
import { MESSAGES } from "@/components/ObjectStore/badgeMessages";

client/src/components/Panels/Common/Tool.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ describe("Tool", () => {
7171
(favoriteButton.element as HTMLElement).focus();
7272
expect(document.activeElement).toBe(favoriteButton.element);
7373

74-
wrapper.destroy();
74+
wrapper.unmount();
7575
});
7676
});

client/src/composables/accessibleHover.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe("useAccessibleHover", () => {
4949
await advanceTooltipHoverDelay();
5050
expect(onEnter).toHaveBeenCalledTimes(1);
5151

52-
wrapper.destroy();
52+
wrapper.unmount();
5353
});
5454

5555
test("cancels delayed hover enter on mouseleave", async () => {
@@ -68,7 +68,7 @@ describe("useAccessibleHover", () => {
6868
expect(onEnter).not.toHaveBeenCalled();
6969
expect(onExit).not.toHaveBeenCalled();
7070

71-
wrapper.destroy();
71+
wrapper.unmount();
7272
});
7373

7474
test("shows immediately on focus", () => {
@@ -81,6 +81,6 @@ describe("useAccessibleHover", () => {
8181
element.dispatchEvent(new Event("focus"));
8282
expect(onEnter).toHaveBeenCalledTimes(1);
8383

84-
wrapper.destroy();
84+
wrapper.unmount();
8585
});
8686
});

0 commit comments

Comments
 (0)