2022-08-23 20:08:53 +02:00
|
|
|
import { ParsedNode, parseNode, parseNodesJson } from "./monitoringService";
|
|
|
|
import { Domain, MAC, OnlineState, Site, UnixTimestampSeconds } from "../types";
|
|
|
|
import Logger from "../logger";
|
2022-09-14 16:33:43 +02:00
|
|
|
import type { MockLogger } from "../__mocks__/logger";
|
2022-08-23 20:08:53 +02:00
|
|
|
import { now, parseTimestamp } from "../utils/time";
|
2020-06-30 01:10:18 +02:00
|
|
|
|
|
|
|
const mockedLogger = Logger as MockLogger;
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
jest.mock("../logger");
|
|
|
|
jest.mock("../db/database");
|
2020-06-30 01:10:18 +02:00
|
|
|
|
|
|
|
const NODES_JSON_INVALID_VERSION = 1;
|
|
|
|
const NODES_JSON_VALID_VERSION = 2;
|
|
|
|
|
|
|
|
const TIMESTAMP_INVALID_STRING = "2020-01-02T42:99:23.000Z";
|
|
|
|
const TIMESTAMP_VALID_STRING = "2020-01-02T12:34:56.000Z";
|
|
|
|
|
2022-07-21 18:39:33 +02:00
|
|
|
const PARSED_TIMESTAMP_VALID = parseTimestamp(TIMESTAMP_VALID_STRING);
|
|
|
|
if (PARSED_TIMESTAMP_VALID === null) {
|
|
|
|
fail("Should not happen: Parsed valid timestamp as invalid.");
|
|
|
|
}
|
|
|
|
const TIMESTAMP_VALID: UnixTimestampSeconds = PARSED_TIMESTAMP_VALID;
|
2020-06-30 01:10:18 +02:00
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
mockedLogger.reset();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNode() should fail parsing node for empty node data", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
2022-07-21 18:39:33 +02:00
|
|
|
const importTimestamp = now();
|
2020-06-30 01:10:18 +02:00
|
|
|
const nodeData = {};
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNode(importTimestamp, nodeData)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNode() should fail parsing node for empty node info", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
2022-07-21 18:39:33 +02:00
|
|
|
const importTimestamp = now();
|
2020-06-30 01:10:18 +02:00
|
|
|
const nodeData = {
|
2022-08-23 20:08:53 +02:00
|
|
|
nodeinfo: {},
|
2020-06-30 01:10:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNode(importTimestamp, nodeData)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNode() should fail parsing node for non-string node id", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
2022-07-21 18:39:33 +02:00
|
|
|
const importTimestamp = now();
|
2020-06-30 01:10:18 +02:00
|
|
|
const nodeData = {
|
|
|
|
nodeinfo: {
|
2022-08-23 20:08:53 +02:00
|
|
|
node_id: 42,
|
|
|
|
},
|
2020-06-30 01:10:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNode(importTimestamp, nodeData)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNode() should fail parsing node for empty node id", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
2022-07-21 18:39:33 +02:00
|
|
|
const importTimestamp = now();
|
2020-06-30 01:10:18 +02:00
|
|
|
const nodeData = {
|
|
|
|
nodeinfo: {
|
2022-08-23 20:08:53 +02:00
|
|
|
node_id: "",
|
|
|
|
},
|
2020-06-30 01:10:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNode(importTimestamp, nodeData)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNode() should fail parsing node for empty network info", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
2022-07-21 18:39:33 +02:00
|
|
|
const importTimestamp = now();
|
2020-06-30 01:10:18 +02:00
|
|
|
const nodeData = {
|
|
|
|
nodeinfo: {
|
|
|
|
node_id: "1234567890ab",
|
2022-08-23 20:08:53 +02:00
|
|
|
network: {},
|
|
|
|
},
|
2020-06-30 01:10:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNode(importTimestamp, nodeData)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNode() should fail parsing node for invalid mac", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
2022-07-21 18:39:33 +02:00
|
|
|
const importTimestamp = now();
|
2020-06-30 01:10:18 +02:00
|
|
|
const nodeData = {
|
|
|
|
nodeinfo: {
|
|
|
|
node_id: "1234567890ab",
|
|
|
|
network: {
|
2022-08-23 20:08:53 +02:00
|
|
|
mac: "xxx",
|
|
|
|
},
|
|
|
|
},
|
2020-06-30 01:10:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNode(importTimestamp, nodeData)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNode() should fail parsing node for missing flags", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
2022-07-21 18:39:33 +02:00
|
|
|
const importTimestamp = now();
|
2020-06-30 01:10:18 +02:00
|
|
|
const nodeData = {
|
|
|
|
nodeinfo: {
|
|
|
|
node_id: "1234567890ab",
|
|
|
|
network: {
|
2022-08-23 20:08:53 +02:00
|
|
|
mac: "12:34:56:78:90:ab",
|
|
|
|
},
|
|
|
|
},
|
2020-06-30 01:10:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNode(importTimestamp, nodeData)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNode() should fail parsing node for empty flags", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
2022-07-21 18:39:33 +02:00
|
|
|
const importTimestamp = now();
|
2020-06-30 01:10:18 +02:00
|
|
|
const nodeData = {
|
|
|
|
nodeinfo: {
|
|
|
|
node_id: "1234567890ab",
|
|
|
|
network: {
|
2022-08-23 20:08:53 +02:00
|
|
|
mac: "12:34:56:78:90:ab",
|
|
|
|
},
|
2020-06-30 01:10:18 +02:00
|
|
|
},
|
2022-08-23 20:08:53 +02:00
|
|
|
flags: {},
|
2020-06-30 01:10:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNode(importTimestamp, nodeData)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNode() should fail parsing node for missing last seen timestamp", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
2022-07-21 18:39:33 +02:00
|
|
|
const importTimestamp = now();
|
2020-06-30 01:10:18 +02:00
|
|
|
const nodeData = {
|
|
|
|
nodeinfo: {
|
|
|
|
node_id: "1234567890ab",
|
|
|
|
network: {
|
2022-08-23 20:08:53 +02:00
|
|
|
mac: "12:34:56:78:90:ab",
|
|
|
|
},
|
2020-06-30 01:10:18 +02:00
|
|
|
},
|
|
|
|
flags: {
|
2022-08-23 20:08:53 +02:00
|
|
|
online: true,
|
|
|
|
},
|
2020-06-30 01:10:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNode(importTimestamp, nodeData)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNode() should fail parsing node for invalid last seen timestamp", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
2022-07-21 18:39:33 +02:00
|
|
|
const importTimestamp = now();
|
2020-06-30 01:10:18 +02:00
|
|
|
const nodeData = {
|
|
|
|
nodeinfo: {
|
|
|
|
node_id: "1234567890ab",
|
|
|
|
network: {
|
2022-08-23 20:08:53 +02:00
|
|
|
mac: "12:34:56:78:90:ab",
|
|
|
|
},
|
2020-06-30 01:10:18 +02:00
|
|
|
},
|
|
|
|
flags: {
|
2022-08-23 20:08:53 +02:00
|
|
|
online: true,
|
2020-06-30 01:10:18 +02:00
|
|
|
},
|
2022-08-23 20:08:53 +02:00
|
|
|
lastseen: 42,
|
2020-06-30 01:10:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNode(importTimestamp, nodeData)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNode() should succeed parsing node without site and domain", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
2022-07-21 18:39:33 +02:00
|
|
|
const importTimestamp = now();
|
2020-06-30 01:10:18 +02:00
|
|
|
const nodeData = {
|
|
|
|
nodeinfo: {
|
|
|
|
node_id: "1234567890ab",
|
|
|
|
network: {
|
2022-08-23 20:08:53 +02:00
|
|
|
mac: "12:34:56:78:90:ab",
|
|
|
|
},
|
2020-06-30 01:10:18 +02:00
|
|
|
},
|
|
|
|
flags: {
|
2022-08-23 20:08:53 +02:00
|
|
|
online: true,
|
2020-06-30 01:10:18 +02:00
|
|
|
},
|
2022-08-23 20:08:53 +02:00
|
|
|
lastseen: TIMESTAMP_VALID_STRING,
|
2020-06-30 01:10:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// then
|
|
|
|
const expectedParsedNode: ParsedNode = {
|
2022-07-18 17:49:42 +02:00
|
|
|
mac: "12:34:56:78:90:AB" as MAC,
|
2020-06-30 01:10:18 +02:00
|
|
|
importTimestamp: importTimestamp,
|
2022-05-26 13:58:01 +02:00
|
|
|
state: OnlineState.ONLINE,
|
2022-07-21 18:39:33 +02:00
|
|
|
lastSeen: TIMESTAMP_VALID,
|
2022-07-28 15:08:41 +02:00
|
|
|
site: undefined,
|
|
|
|
domain: undefined,
|
2020-06-30 01:10:18 +02:00
|
|
|
};
|
|
|
|
expect(parseNode(importTimestamp, nodeData)).toEqual(expectedParsedNode);
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNode() should succeed parsing node with site and domain", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
2022-07-21 18:39:33 +02:00
|
|
|
const importTimestamp = now();
|
2020-06-30 01:10:18 +02:00
|
|
|
const nodeData = {
|
|
|
|
nodeinfo: {
|
|
|
|
node_id: "1234567890ab",
|
|
|
|
network: {
|
2022-08-23 20:08:53 +02:00
|
|
|
mac: "12:34:56:78:90:ab",
|
2020-06-30 01:10:18 +02:00
|
|
|
},
|
|
|
|
system: {
|
|
|
|
site_code: "test-site",
|
2022-08-23 20:08:53 +02:00
|
|
|
domain_code: "test-domain",
|
|
|
|
},
|
2020-06-30 01:10:18 +02:00
|
|
|
},
|
|
|
|
flags: {
|
2022-08-23 20:08:53 +02:00
|
|
|
online: true,
|
2020-06-30 01:10:18 +02:00
|
|
|
},
|
|
|
|
lastseen: TIMESTAMP_VALID_STRING,
|
|
|
|
};
|
|
|
|
|
|
|
|
// then
|
|
|
|
const expectedParsedNode: ParsedNode = {
|
2022-07-18 17:49:42 +02:00
|
|
|
mac: "12:34:56:78:90:AB" as MAC,
|
2020-06-30 01:10:18 +02:00
|
|
|
importTimestamp: importTimestamp,
|
2022-05-26 13:58:01 +02:00
|
|
|
state: OnlineState.ONLINE,
|
2022-07-21 18:39:33 +02:00
|
|
|
lastSeen: TIMESTAMP_VALID,
|
2022-07-18 17:49:42 +02:00
|
|
|
site: "test-site" as Site,
|
|
|
|
domain: "test-domain" as Domain,
|
2020-06-30 01:10:18 +02:00
|
|
|
};
|
|
|
|
expect(parseNode(importTimestamp, nodeData)).toEqual(expectedParsedNode);
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNodesJson() should fail parsing empty string", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
|
|
|
const json = "";
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNodesJson(json)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNodesJson() should fail parsing malformed JSON", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
|
|
|
const json = '{"version": 2]';
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNodesJson(json)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNodesJson() should fail parsing JSON null", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
|
|
|
const json = JSON.stringify(null);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNodesJson(json)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNodesJson() should fail parsing JSON string", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
|
|
|
const json = JSON.stringify("foo");
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNodesJson(json)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNodesJson() should fail parsing JSON number", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
|
|
|
const json = JSON.stringify(42);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNodesJson(json)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNodesJson() should fail parsing empty JSON object", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
|
|
|
const json = JSON.stringify({});
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNodesJson(json)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNodesJson() should fail parsing for mismatching version", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
|
|
|
const json = JSON.stringify({
|
2022-08-23 20:08:53 +02:00
|
|
|
version: NODES_JSON_INVALID_VERSION,
|
2020-06-30 01:10:18 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNodesJson(json)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNodesJson() should fail parsing for missing timestamp", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
|
|
|
const json = JSON.stringify({
|
|
|
|
version: NODES_JSON_VALID_VERSION,
|
2022-08-23 20:08:53 +02:00
|
|
|
nodes: [],
|
2020-06-30 01:10:18 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNodesJson(json)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNodesJson() should fail parsing for invalid timestamp", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
|
|
|
const json = JSON.stringify({
|
|
|
|
version: NODES_JSON_VALID_VERSION,
|
|
|
|
timestamp: TIMESTAMP_INVALID_STRING,
|
2022-08-23 20:08:53 +02:00
|
|
|
nodes: [],
|
2020-06-30 01:10:18 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNodesJson(json)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNodesJson() should fail parsing for nodes object instead of array", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
|
|
|
const json = JSON.stringify({
|
|
|
|
version: NODES_JSON_VALID_VERSION,
|
|
|
|
timestamp: TIMESTAMP_VALID_STRING,
|
2022-08-23 20:08:53 +02:00
|
|
|
nodes: {},
|
2020-06-30 01:10:18 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(() => parseNodesJson(json)).toThrowError();
|
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNodesJson() should succeed parsing no nodes", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
|
|
|
const json = JSON.stringify({
|
|
|
|
version: NODES_JSON_VALID_VERSION,
|
|
|
|
timestamp: TIMESTAMP_VALID_STRING,
|
2022-08-23 20:08:53 +02:00
|
|
|
nodes: [],
|
2020-06-30 01:10:18 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// when
|
|
|
|
const result = parseNodesJson(json);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(result.nodes).toEqual([]);
|
2020-06-30 17:08:24 +02:00
|
|
|
expect(result.failedNodesCount).toEqual(0);
|
|
|
|
expect(result.totalNodesCount).toEqual(0);
|
2020-06-30 01:10:18 +02:00
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNodesJson() should skip parsing invalid nodes", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
|
|
|
const json = JSON.stringify({
|
|
|
|
version: NODES_JSON_VALID_VERSION,
|
|
|
|
timestamp: TIMESTAMP_VALID_STRING,
|
|
|
|
nodes: [
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
nodeinfo: {
|
|
|
|
node_id: "1234567890ab",
|
|
|
|
network: {
|
2022-08-23 20:08:53 +02:00
|
|
|
mac: "12:34:56:78:90:ab",
|
2020-06-30 01:10:18 +02:00
|
|
|
},
|
|
|
|
system: {
|
|
|
|
site_code: "test-site",
|
2022-08-23 20:08:53 +02:00
|
|
|
domain_code: "test-domain",
|
|
|
|
},
|
2020-06-30 01:10:18 +02:00
|
|
|
},
|
|
|
|
flags: {
|
2022-08-23 20:08:53 +02:00
|
|
|
online: true,
|
2020-06-30 01:10:18 +02:00
|
|
|
},
|
|
|
|
lastseen: TIMESTAMP_INVALID_STRING,
|
2022-08-23 20:08:53 +02:00
|
|
|
},
|
|
|
|
],
|
2020-06-30 01:10:18 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// when
|
|
|
|
const result = parseNodesJson(json);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(result.nodes).toEqual([]);
|
2020-06-30 17:08:24 +02:00
|
|
|
expect(result.failedNodesCount).toEqual(2);
|
|
|
|
expect(result.totalNodesCount).toEqual(2);
|
2022-08-23 20:08:53 +02:00
|
|
|
expect(
|
|
|
|
mockedLogger.getMessages("error", "monitoring", "parsing-nodes-json")
|
|
|
|
.length
|
|
|
|
).toEqual(2);
|
2020-06-30 01:10:18 +02:00
|
|
|
});
|
|
|
|
|
2022-08-23 20:08:53 +02:00
|
|
|
test("parseNodesJson() should parse valid nodes", () => {
|
2020-06-30 01:10:18 +02:00
|
|
|
// given
|
|
|
|
const json = JSON.stringify({
|
|
|
|
version: NODES_JSON_VALID_VERSION,
|
|
|
|
timestamp: TIMESTAMP_VALID_STRING,
|
|
|
|
nodes: [
|
|
|
|
{}, // keep an invalid one for good measure
|
|
|
|
{
|
|
|
|
nodeinfo: {
|
|
|
|
node_id: "1234567890ab",
|
|
|
|
network: {
|
2022-08-23 20:08:53 +02:00
|
|
|
mac: "12:34:56:78:90:ab",
|
2020-06-30 01:10:18 +02:00
|
|
|
},
|
|
|
|
system: {
|
|
|
|
site_code: "test-site",
|
2022-08-23 20:08:53 +02:00
|
|
|
domain_code: "test-domain",
|
|
|
|
},
|
2020-06-30 01:10:18 +02:00
|
|
|
},
|
|
|
|
flags: {
|
2022-08-23 20:08:53 +02:00
|
|
|
online: true,
|
2020-06-30 01:10:18 +02:00
|
|
|
},
|
|
|
|
lastseen: TIMESTAMP_VALID_STRING,
|
2022-08-23 20:08:53 +02:00
|
|
|
},
|
|
|
|
],
|
2020-06-30 01:10:18 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// when
|
|
|
|
const result = parseNodesJson(json);
|
|
|
|
|
|
|
|
// then
|
|
|
|
const expectedParsedNode: ParsedNode = {
|
2022-07-18 17:49:42 +02:00
|
|
|
mac: "12:34:56:78:90:AB" as MAC,
|
2022-07-21 18:39:33 +02:00
|
|
|
importTimestamp: TIMESTAMP_VALID,
|
2022-05-26 13:58:01 +02:00
|
|
|
state: OnlineState.ONLINE,
|
2022-07-21 18:39:33 +02:00
|
|
|
lastSeen: TIMESTAMP_VALID,
|
2022-07-18 17:49:42 +02:00
|
|
|
site: "test-site" as Site,
|
|
|
|
domain: "test-domain" as Domain,
|
2020-06-30 01:10:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
expect(result.nodes).toEqual([expectedParsedNode]);
|
2020-06-30 17:08:24 +02:00
|
|
|
expect(result.failedNodesCount).toEqual(1);
|
|
|
|
expect(result.totalNodesCount).toEqual(2);
|
2022-08-23 20:08:53 +02:00
|
|
|
expect(
|
|
|
|
mockedLogger.getMessages("error", "monitoring", "parsing-nodes-json")
|
|
|
|
.length
|
|
|
|
).toEqual(1);
|
2020-06-30 01:10:18 +02:00
|
|
|
});
|