From 1e37a2f130c18d506e09356e3dcc80a1f022e364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Sat, 1 Sep 2018 21:23:48 +0100 Subject: [PATCH] feat(tests): add GroupFoote snapshot test --- .../__snapshots__/index.test.js.snap | 79 +++++++++++++++++++ .../AlertGroup/GroupFooter/index.test.js | 54 +++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/__snapshots__/index.test.js.snap create mode 100644 ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/index.test.js diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/__snapshots__/index.test.js.snap b/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/__snapshots__/index.test.js.snap new file mode 100644 index 000000000..503472efe --- /dev/null +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/__snapshots__/index.test.js.snap @@ -0,0 +1,79 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` matches snapshot 1`] = ` +" + +" +`; diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/index.test.js b/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/index.test.js new file mode 100644 index 000000000..c4d39ea2b --- /dev/null +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/index.test.js @@ -0,0 +1,54 @@ +import React from "react"; + +import { Provider } from "mobx-react"; + +import { mount } from "enzyme"; + +import toDiffableHtml from "diffable-html"; + +import { MockAlertGroup, MockAnnotation } from "__mocks__/Alerts.js"; +import { AlertStore } from "Stores/AlertStore"; +import { GroupFooter } from "."; + +let group; +let alertStore; + +const MockGroup = () => { + const group = MockAlertGroup( + { alertname: "Fake Alert" }, + [], + [ + MockAnnotation("summary", "This is summary", true, false), + MockAnnotation("hidden", "This is hidden annotation", false, false), + MockAnnotation("link", "http://link.example.com", true, true) + ], + { label1: "foo", label2: "bar" } + ); + return group; +}; + +const MockAfterUpdate = jest.fn(); + +beforeEach(() => { + alertStore = new AlertStore([]); + group = MockGroup(); +}); + +const MountedGroupFooter = () => { + return mount( + + + + ); +}; + +describe("", () => { + it("matches snapshot", () => { + const tree = MountedGroupFooter().find("GroupFooter"); + expect(toDiffableHtml(tree.html())).toMatchSnapshot(); + }); +});