fix(ui): проверять диапазон AS в каталоге BGP

This commit is contained in:
Denozordec committed 2026-09-30 18:06:18 +07:00
1 parent 748a3c00ad
commit 2199950681
4 files changed
+36 -2

No files matched your search

+24
View File
@@ -93,3 +93,27 @@ test("BGP: неизвестные поля и наблюдаемый ноль н
await expect(page.getByLabel("Сводка префиксов BGP")).toContainText("нет данных API")
await expect(page.getByText("Недостаточно данных о префиксах для сравнения", { exact: true })).toBeVisible()
})
for (const field of ["localAs", "remoteAs"]) for (const invalid of [0, 4294967296]) {
test("BGP: невалидная AS сохраняет снимок " + field + "=" + invalid, async ({ page }) => {
let broken = false
await page.route("**/health", r => r.fulfill({ json: { ok: true } }))
await page.route("**/api/**", r => {
const path = new URL(r.request().url()).pathname
return r.fulfill({ json: path === "/api/servers" ? [server(1)] : path === "/api/bgp/catalog" ? { sessions: [{ ...session(1), ...(broken ? { [field]: invalid } : {}) }], failures: [] } : path === "/api/auth/config" ? { required: false } : {} })
})
await page.goto("/bgp")
const rows = page.locator("tr[data-row-id]")
await expect(rows).toHaveCount(1)
broken = true
await page.getByRole("button", { name: "Обновить", exact: true }).click()
const alert = page.getByRole("alert").filter({ hasText: "Не удалось загрузить BGP" })
await expect(alert).toContainText("Показаны последние полученные данные")
await expect(rows).toHaveCount(1)
await expect(rows).toContainText("Неизвестно")
broken = false
await alert.getByRole("button", { name: "Повторить загрузку BGP" }).click()
await expect(alert).toHaveCount(0)
await expect(rows).toContainText("Established")
})
}