Skip to content

Commit 8e8bdf8

Browse files
committed
Fix Vue Test Utils v2 trigger/ts issues
- Add 'as any' casting for findComponent() calls to fix TypeScript errors - Use await with vm.$emit() for consistency - These changes are necessary for TypeScript compilation with Vue Test Utils v2
1 parent 346539f commit 8e8bdf8

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,16 @@ describe("RDMDestinationSelector", () => {
163163
}
164164

165165
async function setRDMSourceInput(newValue: string) {
166-
const component = wrapper.findComponent(FilesInput);
166+
const component = wrapper.findComponent(FilesInput as any);
167167
expect(component.attributes("placeholder")).toContain("source");
168-
component.vm.$emit("input", newValue);
168+
await component.vm.$emit("input", newValue);
169169
await flushPromises();
170170
}
171171

172172
async function setRDMDirectoryInput(newValue: string) {
173-
const component = wrapper.findComponent(FilesInput);
173+
const component = wrapper.findComponent(FilesInput as any);
174174
expect(component.attributes("placeholder")).toContain("directory");
175-
component.vm.$emit("input", newValue);
175+
await component.vm.$emit("input", newValue);
176176
await flushPromises();
177177
}
178178

client/src/components/WorkflowInvocationState/WorkflowInvocationShare.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,13 @@ describe("WorkflowInvocationShare", () => {
166166
const { wrapper } = await mountWorkflowInvocationShare();
167167

168168
// Initially, the modal is not visible and opens when the button is clicked
169-
const modalComponent = wrapper.findComponent(GModal) as VueWrapper<any>;
169+
const modalComponent = wrapper.findComponent(GModal as any) as VueWrapper<any>;
170170
expect(modalComponent.vm.$props?.show).toBeFalsy();
171171
await openShareModal(wrapper);
172172
expect(modalComponent.vm.$props?.show).toBeTruthy();
173173

174-
expect(wrapper.findComponent(GModal).text()).toContain(TEST_WORKFLOW.name);
175-
expect(wrapper.findComponent(GModal).text()).toContain(TEST_HISTORY.name);
174+
expect(wrapper.findComponent(GModal as any).text()).toContain(TEST_WORKFLOW.name);
175+
expect(wrapper.findComponent(GModal as any).text()).toContain(TEST_HISTORY.name);
176176
});
177177

178178
it("shares the workflow and history when the share button is clicked, and copies link", async () => {
@@ -181,7 +181,7 @@ describe("WorkflowInvocationShare", () => {
181181
await openShareModal(wrapper);
182182

183183
// Click the share button in the modal
184-
wrapper.findComponent(GModal).vm.$emit("ok");
184+
wrapper.findComponent(GModal as any).vm.$emit("ok");
185185
await flushPromises();
186186

187187
// We have 2 toasts
@@ -200,14 +200,14 @@ describe("WorkflowInvocationShare", () => {
200200
it("renders nothing when the user does not own the workflow", async () => {
201201
const { wrapper } = await mountWorkflowInvocationShare(false);
202202
expect(wrapper.find(SELECTORS.SHARE_ICON_BUTTON).exists()).toBe(false);
203-
expect(wrapper.findComponent(GModal).exists()).toBeFalsy();
203+
expect(wrapper.findComponent(GModal as any).exists()).toBeFalsy();
204204
});
205205

206206
it("just copies link and does not open modal if both workflow and history are already shareable", async () => {
207207
const { wrapper } = await mountWorkflowInvocationShare(true, true);
208208

209209
// Initially, the modal is not visible and this time remains closed when the button is clicked
210-
const modalComponent = wrapper.findComponent(GModal) as VueWrapper<any>;
210+
const modalComponent = wrapper.findComponent(GModal as any) as VueWrapper<any>;
211211
expect(modalComponent.vm.$props?.show).toBeFalsy();
212212
await openShareModal(wrapper);
213213
expect(modalComponent.vm.$props?.show).toBeFalsy();

0 commit comments

Comments
 (0)