fix(ui): remove hash tests, it's no longer exposed in the API

This commit is contained in:
Łukasz Mierzwa
2020-01-06 22:23:16 +00:00
parent 2e2591f7c9
commit 378866ae34
5 changed files with 0 additions and 42 deletions
@@ -61,10 +61,8 @@ const MockGroupList = (count, alertPerGroup) => {
let groups = [];
for (let i = 1; i <= count; i++) {
let id = `id${i}`;
let hash = `hash${i}`;
let group = MockGroup(`group${i}`, alertPerGroup);
group.id = id;
group.hash = hash;
groups.push(group);
}
alertStore.data.upstreams = {
-1
View File
@@ -33,7 +33,6 @@ const APIGroup = PropTypes.exact({
labels: PropTypes.object.isRequired,
alerts: PropTypes.arrayOf(APIAlert),
id: PropTypes.string.isRequired,
hash: PropTypes.string.isRequired,
alertmanagerCount: PropTypes.objectOf(PropTypes.number).isRequired,
stateCount: PropTypes.exact({
active: PropTypes.number.isRequired,
-36
View File
@@ -485,21 +485,6 @@ describe("AlertStore.fetch", () => {
expect(store.data.groups).toMatchObject({ foo: "foo", bar: "bar" });
});
it("is no-op for groups that didn't change", () => {
const store = new AlertStore(["label=value"]);
store.data.groups = { foo: { hash: "foo" }, bar: { hash: "bar" } };
const response = EmptyAPIResponse();
response.groups = { foo: { hash: "foo" }, bar: { hash: "bar" } };
store.parseAPIResponse(response);
expect(Object.keys(store.data.groups)).toHaveLength(2);
expect(store.data.groups).toMatchObject({
foo: { hash: "foo" },
bar: { hash: "bar" }
});
});
it("removes old groups from the store after fetch", () => {
const store = new AlertStore(["label=value"]);
store.data.groups = { foo: "foo", delete: "me", bar: "bar" };
@@ -512,25 +497,4 @@ describe("AlertStore.fetch", () => {
expect(Object.keys(store.data.groups)).toHaveLength(2);
expect(store.data.groups).toMatchObject({ foo: "foo", bar: "bar" });
});
it("updates groups with new hash after fetch", () => {
const store = new AlertStore(["label=value"]);
store.data.groups = [
{ id: "foo", hash: "foo" },
{ id: "bar", hash: "bar" }
];
const response = EmptyAPIResponse();
response.groups = [
{ id: "foo", hash: "newFoo" },
{ id: "bar", hash: "newBar" }
];
store.parseAPIResponse(response);
expect(store.data.groups).toHaveLength(2);
expect(store.data.groups).toMatchObject([
{ id: "foo", hash: "newFoo" },
{ id: "bar", hash: "newBar" }
]);
});
});
-1
View File
@@ -35,7 +35,6 @@ const MockAlertGroup = (
labels: rootLabels,
alerts: alerts,
id: "099c5ca6d1c92f615b13056b935d0c8dee70f18c",
hash: "53a4bb3d7e916450b3bda550976f9578db5b2ad3",
alertmanagerCount: {
default: 1
},
-2
View File
@@ -185,7 +185,6 @@ const MockGrid = alertStore => {
const unprocessed = Math.max(0, i - active - suppressed);
const id = `id${i}`;
const hash = `hash${i}`;
const group = MockGroup(`group${i}`, i, active, suppressed, unprocessed);
for (let j = 0; j < group.alerts.length; j++) {
@@ -207,7 +206,6 @@ const MockGrid = alertStore => {
}
group.id = id;
group.hash = hash;
group.stateCount.active = active;
group.stateCount.suppressed = suppressed;
group.stateCount.unprocessed = unprocessed;