1
0
mirror of https://github.com/amir20/dozzle.git synced 2026-01-03 03:27:29 +01:00

Changes files

This commit is contained in:
Amir Raminfar
2019-06-12 19:45:25 -07:00
parent d0036f177f
commit 1f7385da36
3 changed files with 108 additions and 1 deletions

1
CNAME
View File

@@ -1 +0,0 @@
dozzle.dev

45
assets/App.spec.js Normal file
View File

@@ -0,0 +1,45 @@
import fetchMock from "fetch-mock";
import EventSource from "eventsourcemock";
import { shallowMount, RouterLinkStub } from "@vue/test-utils";
import App from "./App";
describe("<App />", () => {
const stubs = { RouterLink: RouterLinkStub, "router-view": true };
beforeEach(() => {
global.BASE_PATH = "";
global.EventSource = EventSource;
fetchMock.getOnce("/api/containers.json", [{ id: "abc", name: "Test 1" }, { id: "xyz", name: "Test 2" }]);
});
afterEach(() => fetchMock.reset());
test("is a Vue instance", async () => {
const wrapper = shallowMount(App, { stubs });
expect(wrapper.isVueInstance()).toBeTruthy();
});
test("has right title", async () => {
const wrapper = shallowMount(App, { stubs });
await fetchMock.flush();
expect(wrapper.vm.title).toContain("2 containers");
});
test("renders correctly", async () => {
const wrapper = shallowMount(App, { stubs });
await fetchMock.flush();
expect(wrapper.element).toMatchSnapshot();
});
test("renders router-link correctly", async () => {
const wrapper = shallowMount(App, { stubs });
await fetchMock.flush();
expect(wrapper.find(RouterLinkStub).props().to).toMatchInlineSnapshot(`
Object {
"name": "container",
"params": Object {
"id": "abc",
"name": "Test 1",
},
}
`);
});
});

View File

@@ -0,0 +1,63 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<App /> renders correctly 1`] = `
<div
class="columns is-marginless"
>
<aside
class="column menu is-2-desktop is-3-tablet"
>
<a
class="navbar-burger burger is-white is-hidden-tablet is-pulled-right"
role="button"
>
<span />
<span />
<span />
</a>
<h1
class="title has-text-warning is-marginless"
>
Dozzle
</h1>
<p
class="menu-label is-hidden-mobile"
>
Containers
</p>
<ul
class="menu-list is-hidden-mobile"
>
<li>
<a>
<div
class="hide-overflow"
>
Test 1
</div>
</a>
</li>
<li>
<a>
<div
class="hide-overflow"
>
Test 2
</div>
</a>
</li>
</ul>
</aside>
<div
class="column is-offset-2-desktop is-offset-3-tablet"
>
<router-view-stub />
</div>
</div>
`;