66 lines
1.7 KiB
TypeScript
66 lines
1.7 KiB
TypeScript
import { beforeEach, describe, it, expect } from "vitest";
|
|
import { enUS } from "date-fns/locale";
|
|
import { routes } from "@/router";
|
|
import { createRouter, createWebHistory, Router } from "vue-router";
|
|
import { config, mount } from "@vue/test-utils";
|
|
import { Oruga } from "@oruga-ui/oruga-next";
|
|
import flushPromises from "flush-promises";
|
|
import { getMockClient } from "../../mocks/client";
|
|
import { htmlRemoveId } from "../../common";
|
|
import SkeletonEventResult from "@/components/Event/SkeletonEventResult.vue";
|
|
|
|
config.global.plugins.push(Oruga);
|
|
|
|
let router: Router;
|
|
|
|
beforeEach(async () => {
|
|
router = createRouter({
|
|
history: createWebHistory(),
|
|
routes: routes,
|
|
});
|
|
|
|
// await router.isReady();
|
|
});
|
|
|
|
const generateWrapper = (props: any = {}) => {
|
|
const global_data = getMockClient([]);
|
|
global_data.provide.dateFnsLocale = enUS;
|
|
global_data.plugins = [router];
|
|
return mount(SkeletonEventResult, {
|
|
props: props,
|
|
global: {
|
|
...global_data,
|
|
stubs: {
|
|
RouterLink: false,
|
|
},
|
|
},
|
|
});
|
|
};
|
|
|
|
describe("SkeletonEventResult", () => {
|
|
it("Show row", async () => {
|
|
const wrapper = generateWrapper();
|
|
await wrapper.vm.$nextTick();
|
|
await flushPromises();
|
|
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
|
});
|
|
|
|
it("Show column", async () => {
|
|
const wrapper = generateWrapper({
|
|
viewMode: "column",
|
|
});
|
|
await wrapper.vm.$nextTick();
|
|
await flushPromises();
|
|
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
|
});
|
|
|
|
it("Show not minimal", async () => {
|
|
const wrapper = generateWrapper({
|
|
minimal: false,
|
|
});
|
|
await wrapper.vm.$nextTick();
|
|
await flushPromises();
|
|
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
|
});
|
|
});
|