fix(bgp): отображать только подтверждённые показатели сессий

This commit is contained in:
Denozordec committed 2026-09-30 16:56:28 +07:00
1 parent 7046808429
commit 8fdc4b917b
13 files changed
+148 -169

No files matched your search

+21
View File
@@ -70,3 +70,24 @@ test("BGP: частичный отказ сохраняет устройство
await expect(rows).toHaveCount(0)
await expect(page.getByText("Нет BGP-сессий", { exact: true })).toBeVisible()
})
test("BGP: неизвестные поля и наблюдаемый ноль не подменяются", async ({ page }) => {
await page.route("**/health", r => r.fulfill({ json: { ok: true } }))
await page.route("**/api/**", r => {
const path = new URL(r.request().url()).pathname
const unknown = { ...session(1), state: "Неизвестное состояние RouterOS", holdTime: null, keepalive: null, prefixesRx: null, prefixesTx: null, inputMessages: null, outputMessages: null, afi: "ip,ipv6" }
return r.fulfill({ json: path === "/api/servers" ? [server(1), server(2)] : path === "/api/bgp/catalog" ? { sessions: [unknown, { ...session(2), prefixesRx: 0, prefixesTx: 0 }], failures: [] } : path === "/api/auth/config" ? { required: false } : {} })
})
await page.goto("/bgp")
const rows = page.locator("tr[data-row-id]")
await expect(rows).toHaveCount(2)
await expect(rows.first()).toContainText("Неизвестно")
await expect(rows.last().locator("td").nth(7)).toHaveText("0")
await rows.first().click()
await expect(page.getByText("ip,ipv6", { exact: true })).toBeVisible()
await expect(page.getByText("Нет данных API", { exact: true })).toBeVisible()
await expect(page.getByText("RouterOS Export", { exact: true })).toHaveCount(0)
await page.getByRole("button", { name: "Аналитика", exact: true }).click()
await expect(page.getByLabel("Сводка префиксов BGP")).toContainText("нет данных API")
await expect(page.getByText("Недостаточно данных о префиксах для сравнения", { exact: true })).toBeVisible()
})