34 lines
1.4 KiB
JavaScript
34 lines
1.4 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import { classifyWorkbenchLiveStatus } from "./live-status.mjs";
|
|
|
|
test("Device Pod profile hash evidence is summarized without undefined helper crashes", () => {
|
|
const status = classifyWorkbenchLiveStatus({
|
|
healthLive: { ok: true, data: { serviceId: "hwlab-cloud-api", status: "ok" } },
|
|
restIndex: { ok: true, data: { serviceId: "hwlab-cloud-api", status: "ok" } },
|
|
health: { ok: true, data: { serviceId: "hwlab-cloud-api", status: "ok" } },
|
|
adapter: { ok: true, data: { serviceId: "hwlab-cloud-api", status: "ok" } },
|
|
devicePodStatus: {
|
|
ok: true,
|
|
data: {
|
|
status: "ready",
|
|
serviceId: "hwlab-device-pod",
|
|
summary: {
|
|
devicePodId: "device-pod-71-freq",
|
|
targetId: "71-FREQ",
|
|
profileHash: "abcdef0123456789fedcba9876543210",
|
|
latestEvent: { refs: { traceId: "trc_live_status", operationId: "op_live_status" } }
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
const devicePodProbe = status.probes.find((probe) => probe.serviceId === "hwlab-device-pod");
|
|
assert.ok(devicePodProbe, JSON.stringify(status.probes));
|
|
assert.equal(devicePodProbe.kind, "pass");
|
|
assert.equal(devicePodProbe.reasonCode, "device_pod_ready");
|
|
assert.match(devicePodProbe.evidenceSummary, /profile=abcdef0123456789/u);
|
|
assert.doesNotMatch(devicePodProbe.evidenceSummary, /fedcba9876543210/u);
|
|
});
|