Pass test for Film details and Person component.

This commit is contained in:
2020-12-21 22:20:12 +01:00
parent 2e35d86e1a
commit 21f3ed77a4
3 changed files with 601 additions and 12 deletions

View File

@@ -0,0 +1,30 @@
import { mount, RouterLinkStub } from "@vue/test-utils";
import Person from "./";
import mockPeople from "@/test/fake-people.json";
describe("Person", () => {
it("tests props", () => {
expect(Person.props).toMatchObject({
person: {
type: Object,
default: {},
required: true
}
});
});
it("renders proper link to details", () => {
const wrapper = mount(Person, {
propsData: {
person: mockPeople[0]
},
stubs: {
RouterLink: RouterLinkStub
}
});
expect(wrapper.findComponent(RouterLinkStub).props().to).toBe(
`/people/${mockPeople[0].id}`
);
});
});