Add GridItem test
This commit is contained in:
27
tests/unit/GridItem.spec.js
Normal file
27
tests/unit/GridItem.spec.js
Normal 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");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user