1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-26 07:13:41 +01:00
Files
dozzle/assets/App.spec.js
2020-05-06 15:44:12 -07:00

47 lines
1.1 KiB
JavaScript

import EventSource from "eventsourcemock";
import { shallowMount, RouterLinkStub, createLocalVue } from "@vue/test-utils";
import Vuex from "vuex";
import App from "./App";
const localVue = createLocalVue();
localVue.use(Vuex);
describe("<App />", () => {
const stubs = { RouterLink: RouterLinkStub, "router-view": true, icon: true };
let store;
beforeEach(() => {
global.BASE_PATH = "";
global.EventSource = EventSource;
const state = {
containers: [
{ id: "abc", name: "Test 1" },
{ id: "xyz", name: "Test 2" },
],
settings: { menuWidth: 15 },
};
const actions = {
FETCH_CONTAINERS: () => Promise.resolve(),
};
store = new Vuex.Store({
state,
actions,
});
});
test("has right title", async () => {
const wrapper = shallowMount(App, { stubs, store, localVue });
await wrapper.vm.$nextTick();
expect(wrapper.vm.title).toContain("2 containers");
});
test("renders correctly", async () => {
const wrapper = shallowMount(App, { stubs, store, localVue });
await wrapper.vm.$nextTick();
expect(wrapper.element).toMatchSnapshot();
});
});