Pass test for Film details and Person component.
This commit is contained in:
30
components/Person/Person.spec.js
Normal file
30
components/Person/Person.spec.js
Normal 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}`
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user