31 lines
686 B
JavaScript
31 lines
686 B
JavaScript
import { mount, RouterLinkStub } from "@vue/test-utils";
|
|
import Location from "./";
|
|
import mockLocation from "@/test/fake-locations.json";
|
|
|
|
describe("Location", () => {
|
|
it("tests props", () => {
|
|
expect(Location.props).toMatchObject({
|
|
location: {
|
|
type: Object,
|
|
default: {},
|
|
required: true
|
|
}
|
|
});
|
|
});
|
|
|
|
it("renders proper link to details", () => {
|
|
const wrapper = mount(Location, {
|
|
propsData: {
|
|
location: mockLocation[0]
|
|
},
|
|
stubs: {
|
|
RouterLink: RouterLinkStub
|
|
}
|
|
});
|
|
|
|
expect(wrapper.findComponent(RouterLinkStub).props().to).toBe(
|
|
`/locations/${mockLocation[0].id}`
|
|
);
|
|
});
|
|
});
|