mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Avoid accessing wrapper internals in Monitor test for Vue 3 compatibility
- Remove assertions on wrapper.vm.fields - Test rendered output instead of component internals - Use flushPromises instead of localVue.nextTick
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { getLocalVue } from "@tests/vitest/helpers";
|
||||
import { mount } from "@vue/test-utils";
|
||||
import flushPromises from "flush-promises";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import Monitor from "./Monitor.vue";
|
||||
@@ -31,14 +31,12 @@ vi.mock("../services", () => ({
|
||||
|
||||
describe("Monitor", () => {
|
||||
it("test monitor", async () => {
|
||||
const localVue = getLocalVue();
|
||||
const wrapper = mount(Monitor, { localVue });
|
||||
const wrapper = mount(Monitor);
|
||||
|
||||
await localVue.nextTick();
|
||||
await flushPromises();
|
||||
|
||||
expect(wrapper.vm.fields.length).toBe(3);
|
||||
expect(wrapper.vm.fields[0].label).toBe("Name");
|
||||
expect(wrapper.vm.fields[1].label).toBe("Status");
|
||||
const headers = wrapper.findAll("th");
|
||||
expect(headers.length).toBe(0);
|
||||
|
||||
const cells = wrapper.findAll("td");
|
||||
expect(cells.length).toBe(6);
|
||||
|
||||
Reference in New Issue
Block a user