Skip to content

Commit

Permalink
test: Add spec for VTag that router is called
Browse files Browse the repository at this point in the history
This is linked to gothinkster#195
  • Loading branch information
da-snap committed Oct 4, 2019
1 parent 9251eba commit 05704c9
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/unit/components/VTag.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { mount, createLocalVue } from "@vue/test-utils";

import router from "../../../src/router/index";
import VTag from "../../../src/components/VTag";

const localVue = createLocalVue();
const createWrapper = () => {
return mount(VTag, {
localVue,
router,
propsData: {
name: "Foo"
}
});
};

describe("VTag", () => {
it("should update the route on click", async () => {
const wrapper = createWrapper();
const routerBefore = wrapper.vm.$route.path;
wrapper.find("a").trigger("click");
await localVue.nextTick();
expect(wrapper.vm.$route.path).not.toBe(routerBefore);
});
});

0 comments on commit 05704c9

Please sign in to comment.