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");
});
});