fix(api): передавать происхождение метрик оптимизатора OSPF

This commit is contained in:
Denozordec committed 2026-10-01 00:50:17 +07:00
1 parent 255f272fab
commit 7077844655
13 files changed
+96 -9

No files matched your search

@@ -13,3 +13,17 @@ for(const hasProbe of [true,false])test("Оптимизатор: исходны
await page.getByRole("button",{name:"Маршруты (1)",exact:true}).click()
await expect(page.getByRole("table").filter({hasText:"# Маршрут"})).toContainText("Ping модели")
})
test("Оптимизатор: OSPF исходный ноль и происхождение метрик",async({page})=>{
const unknown={value:null,source:"unknown",sourceId:null,measuredAt:null}
const item={id:"i",interface:"ether1",currentCost:10,optimalCost:20,score:50,pingMs:1,dlMbps:10,ulMbps:10,observed:{ping:{value:0,source:"speed-probe",sourceId:"p",measuredAt:"2020-01-01T00:00:00Z"},dl:unknown,ul:{value:0,source:"interface-traffic",sourceId:"ether1",measuredAt:"2020-01-02T00:00:00Z"}}}
await page.route("**/health",r=>r.fulfill({json:{ok:true}}))
await page.route("**/api/**",r=>{const p=new URL(r.request().url()).pathname;return r.fulfill({json:p==="/api/auth/config"?{required:false}:p==="/api/servers"?[{id:1,name:"Router",host:"192.0.2.1",type:"home-router",country:"RU",enabled:true,status:null}]:p==="/api/filters/rules"?{rulesets:[]}:p==="/api/uptime/speed-probes"?{probes:[]}:p==="/api/ospf/catalog"?{interfaces:[],instances:[],neighbors:[],bfdSessions:[],routes:[],failures:[]}:p.endsWith("/preview")?{serverId:1,serverName:"Router",pingWeight:60,interfacesTotal:1,changedCount:1,unchangedCount:0,interfaces:[item],changes:[item]}:{}})})
await page.goto("/route-optimizer")
const grid=page.getByRole("table").filter({hasText:"Speed (dl/ul)"})
await expect(grid).toContainText("Ping модели")
await expect(grid).toContainText("1ms")
await expect(grid).toContainText("Проба: 0 мс")
await expect(grid).toContainText("Измерение: —")
await expect(grid).toContainText("Трафик интерфейса: 0 Мбит/с")
})