40 lines
921 B
JavaScript
40 lines
921 B
JavaScript
import { mount, RouterLinkStub, createLocalVue } from "@vue/test-utils";
|
|
import Vuex from "vuex";
|
|
import GridItem from "@/components/Grid/GridItem.vue";
|
|
|
|
const localVue = createLocalVue();
|
|
localVue.use(Vuex);
|
|
|
|
describe("Test GridItem.", () => {
|
|
let store;
|
|
|
|
beforeEach(() => {
|
|
store = new Vuex.Store();
|
|
});
|
|
|
|
it("checks link.", async () => {
|
|
const wrapper = mount(GridItem, {
|
|
store,
|
|
localVue,
|
|
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");
|
|
});
|
|
});
|