fix(ui): сохранять переходные и неизвестные состояния OSPF

This commit is contained in:
Denozordec committed 2026-09-30 18:02:11 +07:00
1 parent c18c148a23
commit 3dc25628af
9 files changed
+82 -22

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
import assert from "node:assert/strict"
import { test } from "node:test"
import { normalizeOspfState, normalizeBfdState, ospfNodeState } from "./ospf-state"
test("RouterOS states keep transitional adjacency separate from failure", () => {
assert.deepEqual(["full", "2-way", "ExStart", "exchange", "loading", "attempt", "init", "down"].map(normalizeOspfState), ["Full", "2-Way", "ExStart", "Exchange", "Loading", "Attempt", "Init", "Down"])
assert.equal(normalizeOspfState("future-state"), "Unknown")
assert.equal(normalizeBfdState(""), "Unknown")
assert.equal(normalizeBfdState(" UP "), "Up")
})
test("topology does not infer Down from missing or transitional evidence", () => {
assert.equal(ospfNodeState([]), "none")
assert.equal(ospfNodeState(["Down"]), "Down")
assert.equal(ospfNodeState(["Down", "Unknown"]), "Unknown")
assert.equal(ospfNodeState(["Exchange", "Loading"]), "Pending")
assert.equal(ospfNodeState(["2-Way", "Down"]), "2-Way")
assert.equal(ospfNodeState(["Full", "Unknown"]), "Full")
})