Add GridItem test

This commit is contained in:
2020-12-06 16:03:41 +01:00
parent 397470bc70
commit 7893b25910
11 changed files with 157 additions and 93 deletions

View File

@@ -0,0 +1,27 @@
import { mount, RouterLinkStub } from "@vue/test-utils";
import GridItem from "@/components/GridItem.vue";
describe("Test GridItem.", () => {
it("checks link.", async () => {
const wrapper = mount(GridItem, {
propsData: {
item: {
id: 3,
isFruit: true,
name: "banana",
image: "/image/path.jpg",
price: "907.00",
color: "#763e44",
description: "Iusto illum vero voluptatem.",
taste: "Handcrafted",
expires: "2021-04-11T08:54:24.588Z"
}
},
stubs: {
RouterLink: RouterLinkStub
}
});
expect(wrapper.findComponent(RouterLinkStub).props().to).toBe("/fruit/3");
});
});

View File

@@ -2,7 +2,7 @@ import { mount } from "@vue/test-utils";
import App from "@/App.vue";
describe("App", () => {
const wrapper = mount(App, { stubs: ["router-view"] });
const wrapper = mount(App, { stubs: ["router-view", "router-link"] });
it("should be a Vue instance", () => {
expect(wrapper.vm).toBeTruthy();