Fix locations details page + pass test

This commit is contained in:
2020-12-21 22:56:28 +01:00
parent 3a8c052d86
commit 16a0dc47da
2 changed files with 27 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
import { mount, createLocalVue } from "@vue/test-utils";
import Vuex from "vuex";
import Location from "./_id";
import mockLocations from "@/test/fake-locations.json";
let $route = {
path: "/locations",
@@ -22,11 +23,25 @@ describe("Location page", () => {
actions = {
getLocation: jest.fn()
};
store = new Vuex.Store({ state, actions });
store = new Vuex.Store({
modules: {
locations: {
namespaced: true,
state,
actions
}
}
});
});
it("should render Location page instance", () => {
const wrapper = mount(Location, { localVue, store });
const wrapper = mount(Location, {
localVue,
store,
computed: {
location: () => mockLocations[0]
}
});
expect(wrapper.exists()).toBe(true);
});
@@ -47,7 +62,10 @@ describe("Location page", () => {
it("should dispatch getLocation action", async () => {
let wrapper = mount(Location, {
localVue,
store
store,
computed: {
location: () => mockLocations[0]
}
});
await wrapper.vm.$options.asyncData({ store, params: $route.params });