chore(ui): user offset and raw filter from the api response

This commit is contained in:
Łukasz Mierzwa
2019-07-14 18:22:09 +01:00
parent e36f25a248
commit 2bdbfeb16f
4 changed files with 71 additions and 18 deletions

View File

@@ -6,7 +6,7 @@ import { mount } from "enzyme";
import toDiffableHtml from "diffable-html";
import { AlertStore } from "Stores/AlertStore";
import { AlertStore, NewUnappliedFilter } from "Stores/AlertStore";
import { OverviewModalContent } from "./OverviewModalContent";
let alertStore;
@@ -23,14 +23,31 @@ afterEach(() => {
describe("<OverviewModalContent />", () => {
it("matches snapshot with labels to show", () => {
alertStore.filters.values = [
NewUnappliedFilter("abc=xyz"),
NewUnappliedFilter("foo=bar")
];
alertStore.data.counters = [
{
name: "foo",
hits: 16,
values: [
{ value: "bar1", hits: 8, percent: 50 },
{ value: "bar2", hits: 4, percent: 25 },
{ value: "bar3", hits: 4, percent: 25 }
{ value: "bar1", raw: "foo=bar1", hits: 8, percent: 50, offset: 0 },
{ value: "bar2", raw: "foo=bar2", hits: 4, percent: 25, offset: 50 },
{ value: "bar3", raw: "foo=bar3", hits: 4, percent: 25, offset: 75 }
]
},
{
name: "alertname",
hits: 5,
values: [
{
value: "Host_Down",
raw: "alertname=Host_Down",
hits: 5,
percent: 100,
offset: 0
}
]
}
];