update frontend lib : remove histoire (obselete) + update vitest - #1815
This commit is contained in:
63
tests/unit/specs/components/core/MaterialIcon.spec.ts
Normal file
63
tests/unit/specs/components/core/MaterialIcon.spec.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
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, shallowMount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import { htmlRemoveId } from "../../common";
|
||||
import MaterialIcon from "@/components/core/MaterialIcon.vue";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const generateWrapper = (iconname: string) => {
|
||||
const global_data = getMockClient([]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return shallowMount(MaterialIcon, {
|
||||
props: {
|
||||
icon: ["", iconname],
|
||||
},
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("MaterialIcon", () => {
|
||||
it("Show GoogleHangouts", async () => {
|
||||
const wrapper = generateWrapper("GoogleHangouts");
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("Show CalendarStar", async () => {
|
||||
const wrapper = generateWrapper("CalendarStar");
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("Show account-multiple-plus", async () => {
|
||||
const wrapper = generateWrapper("account-multiple-plus");
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`MaterialIcon > Show CalendarStar 1`] = `"<async-component-wrapper-stub size="18"></async-component-wrapper-stub>"`;
|
||||
|
||||
exports[`MaterialIcon > Show GoogleHangouts 1`] = `"<async-component-wrapper-stub size="18"></async-component-wrapper-stub>"`;
|
||||
|
||||
exports[`MaterialIcon > Show account-multiple-plus 1`] = `"<async-component-wrapper-stub size="18"></async-component-wrapper-stub>"`;
|
||||
Reference in New Issue
Block a user