mirror of
https://github.com/jason5ng32/MyIP.git
synced 2026-11-04 08:55:47 +00:00
Fix(tests): expect a 502 from the ASN Profile handler test without CAIDA data
With connectivity now an error when no as-rel snapshot is loaded, the network-down handler test has no working source on a data-less checkout (CI), so the handler rightly answers 502. The test asserts that there and keeps its 200 expectations where a snapshot exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
034f5177c6
commit
c85c33d13a
1 file changed
+10
-4
@@ -734,6 +734,15 @@ describe('asn-profile handler', () => {
|
||||
const res = createResponse();
|
||||
await asnProfileHandler(createRequest({ query: { asn: '64511' } }), res);
|
||||
|
||||
// With the network down, the local CAIDA graph is the one source that
|
||||
// can answer — when this checkout has an as-rel snapshot. Without one
|
||||
// (CI, a fresh checkout) connectivity is an error too, every
|
||||
// configured source has failed, and the answer is a 502.
|
||||
if (!isAsRelLoaded()) {
|
||||
assert.equal(res.statusCode, 502);
|
||||
assert.equal(res.body.status.connectivity, 'error');
|
||||
return;
|
||||
}
|
||||
assert.equal(res.statusCode, 200);
|
||||
assert.equal(res.body.asn, 64511);
|
||||
assert.equal(res.body.status.radar, 'disabled');
|
||||
@@ -741,10 +750,7 @@ describe('asn-profile handler', () => {
|
||||
assert.equal(res.body.status.reputation, 'disabled');
|
||||
assert.equal(res.body.status.whois, 'error');
|
||||
assert.equal(res.body.status.rank, 'error');
|
||||
// Local: ok / empty with an as-rel snapshot, an error (never a
|
||||
// cacheable empty) without one — a fresh checkout.
|
||||
if (isAsRelLoaded()) assert.ok(['ok', 'empty'].includes(res.body.status.connectivity));
|
||||
else assert.equal(res.body.status.connectivity, 'error');
|
||||
assert.ok(['ok', 'empty'].includes(res.body.status.connectivity));
|
||||
assert.equal(res.body.whois, null);
|
||||
assert.equal(res.body.rank, null);
|
||||
// No Cloudflare key: PeeringDB isn't configured here.
|
||||
|
||||
Reference in new issue
Block a user