correct and complete unit tests in Front-End
This commit is contained in:
@@ -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,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user