Testing GridItem + AddFruit components

This commit is contained in:
2020-12-08 18:03:48 +01:00
parent 065ff6f3ff
commit b5ceae6c00
24 changed files with 844 additions and 380 deletions

View File

@@ -5,30 +5,40 @@ import GridItem from "@/components/Grid/GridItem.vue";
const localVue = createLocalVue();
localVue.use(Vuex);
describe("Test GridItem.", () => {
describe("Test GridItem component.", () => {
let store;
const 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"
};
beforeEach(() => {
store = new Vuex.Store();
});
it("takes a snapshot of the component.", () => {
const wrapper = mount(GridItem, {
store,
localVue,
propsData: { item },
stubs: ["router-link"]
});
expect(wrapper.html()).toMatchSnapshot();
});
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"
}
},
propsData: { item },
stubs: {
RouterLink: RouterLinkStub
}