correct and complete unit tests in Front-End

This commit is contained in:
Laurent GAY
2025-06-11 18:49:45 +02:00
parent 2fa54e8282
commit 533ecbdbba
67 changed files with 1900 additions and 203 deletions

View File

@@ -4,6 +4,8 @@ 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 { DEFAULT_PICTURE } from "@/graphql/config";
import { getMockClient } from "../../mocks/client";
let router: Router;
@@ -30,17 +32,15 @@ const generateWrapper = (
customPostData: Record<string, unknown> = {},
customProps: Record<string, unknown> = {}
) => {
const global_data = getMockClient([DEFAULT_PICTURE]);
global_data.provide.dateFnsLocale = enUS;
global_data.plugins = [router];
return mount(PostListItem, {
props: {
post: { ...postData, ...customPostData },
...customProps,
},
global: {
provide: {
dateFnsLocale: enUS,
},
plugins: [router],
},
global: global_data,
});
};