Create Location component + tests
This commit is contained in:
30
components/Location/Location.spec.js
Normal file
30
components/Location/Location.spec.js
Normal file
@@ -0,0 +1,30 @@
|
||||
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}`
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user