Testing GridItem + AddFruit components
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user