Fix people details page + pass test
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { mount, createLocalVue } from "@vue/test-utils";
|
||||
import Vuex from "vuex";
|
||||
import Person from "./_id";
|
||||
import mockPeople from "@/test/fake-people.json";
|
||||
|
||||
let $route = {
|
||||
path: "/people",
|
||||
@@ -22,11 +23,25 @@ describe("Person page", () => {
|
||||
actions = {
|
||||
getPerson: jest.fn()
|
||||
};
|
||||
store = new Vuex.Store({ state, actions });
|
||||
store = new Vuex.Store({
|
||||
modules: {
|
||||
people: {
|
||||
namespaced: true,
|
||||
state,
|
||||
actions
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("should render Person page instance", () => {
|
||||
const wrapper = mount(Person, { localVue, store });
|
||||
const wrapper = mount(Person, {
|
||||
localVue,
|
||||
store,
|
||||
computed: {
|
||||
person: () => mockPeople[0]
|
||||
}
|
||||
});
|
||||
expect(wrapper.exists()).toBe(true);
|
||||
});
|
||||
|
||||
@@ -47,7 +62,10 @@ describe("Person page", () => {
|
||||
it("should dispatch getPerson action", async () => {
|
||||
let wrapper = mount(Person, {
|
||||
localVue,
|
||||
store
|
||||
store,
|
||||
computed: {
|
||||
person: () => mockPeople[0]
|
||||
}
|
||||
});
|
||||
|
||||
await wrapper.vm.$options.asyncData({ store, params: $route.params });
|
||||
|
||||
Reference in New Issue
Block a user