Introduce basic js unit tests
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
24
js/tests/unit/specs/boot/routes.spec.ts
Normal file
24
js/tests/unit/specs/boot/routes.spec.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { config, createLocalVue, mount } from "@vue/test-utils";
|
||||
import { routes } from "@/router";
|
||||
import App from "@/App.vue";
|
||||
import VueRouter from "vue-router";
|
||||
import Home from "@/views/Home.vue";
|
||||
|
||||
const localVue = createLocalVue();
|
||||
config.mocks.$t = (key: string): string => key;
|
||||
localVue.use(VueRouter);
|
||||
|
||||
const router = new VueRouter({ routes });
|
||||
const wrapper = mount(App, {
|
||||
localVue,
|
||||
router,
|
||||
stubs: ["NavBar", "mobilizon-footer"],
|
||||
});
|
||||
|
||||
describe("routing", () => {
|
||||
test("Homepage", async () => {
|
||||
router.push("/");
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(wrapper.findComponent(Home).exists()).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user