fix(evolution): проверять каталог и сохранять неизвестные счётчики
This commit is contained in:
1 parent
9db1471b2c
commit
7e3cb754b0
16 files changed
+140
-82
No files matched your search
@@ -15,3 +15,17 @@ test("ASN and community zero counts are preserved, invalid counts rejected", ()
|
||||
assert.equal(parseEvoBgpCatalog({ ...empty, asns: [asn] }).asns[0].prefixes, 0)
|
||||
assert.throws(() => parseEvoBgpCatalog({ ...empty, asns: [{ ...asn, prefixes: -1 }] }))
|
||||
})
|
||||
|
||||
|
||||
test("unknown counts stay nullable and differ from confirmed zero", () => {
|
||||
const asn = { id: "asn-unknown", asn: "AS64512", org: "", country: "", prefixes: null, filter: "", updated: "—", enabled: true }
|
||||
const community = { id: "c", value: "64512:1", name: "c", description: "", type: "custom", filterIds: [], serverCount: 0, prefixCount: null, action: "permit", enabled: true }
|
||||
const result = parseEvoBgpCatalog({...empty, asns:[asn], communities:[community]})
|
||||
assert.equal(result.asns[0].prefixes,null)
|
||||
assert.equal(result.communities[0].prefixCount,null)
|
||||
assert.equal(result.communities[0].serverCount,0)
|
||||
for(const value of [undefined,-1,1.5,Number.MAX_SAFE_INTEGER+1]) {
|
||||
assert.throws(()=>parseEvoBgpCatalog({...empty,asns:[{...asn,prefixes:value}]}))
|
||||
assert.throws(()=>parseEvoBgpCatalog({...empty,communities:[{...community,prefixCount:value}]}))
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user