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

Adds a test for filter

This commit is contained in:
Amir
2019-11-07 12:05:18 -08:00
parent fa0f743cb4
commit 707ab974a1

View File

@@ -102,4 +102,25 @@ describe("<Container />", () => {
</ul>
`);
});
test("should render messages with filter", async () => {
const wrapper = shallowMount(Container, {
propsData: { id: "abc" }
});
sources["/api/logs/stream?id=abc"].emitOpen();
sources["/api/logs/stream?id=abc"].emitMessage({
data: `2019-06-11T10:55:42.459034602Z Foo bar`
});
sources["/api/logs/stream?id=abc"].emitMessage({
data: `2019-06-12T10:55:42.459034602Z This is a test <hi></hi>`
});
wrapper.setData({ filter: "test" });
expect(wrapper.find("ul.events")).toMatchInlineSnapshot(`
<ul class="events">
<li class="event"><span class="date">today at 10:55 AM</span> <span class="text"> This is a <mark>test</mark> &lt;hi&gt;&lt;/hi&gt;</span></li>
</ul>
`);
});
});