All checks were successful
deploy / deploy (push) Successful in 33s
Proof: npm test; npm run operator-dashboard:build; node --test test/near-intents-status.test.mjs test/operator-dashboard.test.mjs test/operator-dashboard-ui-static.test.mjs; PYTHONPATH=. python3 test/repo_deployments_test.py; kubectl kustomize deploy/k8s/base; live normalization against https://status.near-intents.org returned disrupted/upstream paused for the current 1Click quoting pause. Assumptions: NEAR Intents public status page API is the official upstream disruption source for operator display; relay websocket reachability remains separately observed by ingest and executor state. Still fake: This does not add an alternate quote source or recover trading while NEAR Intents quoting is paused; it only makes the upstream disruption explicit and separates it from local service freshness.
83 lines
3.1 KiB
JavaScript
83 lines
3.1 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
|
|
import { normalizeNearIntentsStatus } from '../src/core/near-intents-status.mjs';
|
|
|
|
const postEnumsResponse = {
|
|
post_enums: [
|
|
{ id: 'PSCS3IV', post_enum_type: 'status', name: 'investigating' },
|
|
{ id: 'PP34365', post_enum_type: 'status', name: 'detected' },
|
|
{ id: 'P8TG2TF', post_enum_type: 'status', name: 'resolved' },
|
|
{ id: 'P187122', post_enum_type: 'severity', name: 'minor' },
|
|
{ id: 'PCIGMKW', post_enum_type: 'severity', name: 'degraded' },
|
|
],
|
|
};
|
|
|
|
const servicesResponse = {
|
|
services: [
|
|
{ id: 'PXQFSY1', name: 'Cross-Chain Bridging', display_name: 'Cross-Chain Bridging' },
|
|
{ id: 'PLT88AT', name: 'Solvers Network', display_name: 'Solvers Network' },
|
|
],
|
|
};
|
|
|
|
test('NEAR Intents status normalizer exposes current quoting disruption as upstream paused evidence', () => {
|
|
const normalized = normalizeNearIntentsStatus({
|
|
observedAt: '2026-04-16T12:40:00.000Z',
|
|
servicesResponse,
|
|
postEnumsResponse,
|
|
postsResponse: {
|
|
posts: [{
|
|
id: 'PM7LK6N',
|
|
title: '1Click Quoting is temporarily stopped',
|
|
post_type: 'incident',
|
|
latest_update: {
|
|
status_id: 'PSCS3IV',
|
|
severity_id: 'P187122',
|
|
reported_at: 1776342420000,
|
|
impacts: [{ service_id: 'PXQFSY1', severity_id: 'PCIGMKW' }],
|
|
message: '<p>The protocol is paused due to a security incident. Swaps are paused.</p>',
|
|
},
|
|
}],
|
|
},
|
|
});
|
|
|
|
assert.equal(normalized.source, 'near_intents_status_page');
|
|
assert.equal(normalized.status, 'disrupted');
|
|
assert.equal(normalized.label, 'upstream paused');
|
|
assert.equal(normalized.quoting_stopped, true);
|
|
assert.deepEqual(normalized.affected_services, ['Cross-Chain Bridging']);
|
|
assert.equal(normalized.current_incident_count, 1);
|
|
assert.equal(normalized.current_incidents[0].status, 'investigating');
|
|
assert.equal(normalized.current_incidents[0].severity, 'minor');
|
|
assert.equal(normalized.current_incidents[0].impacts[0].severity, 'degraded');
|
|
assert.match(normalized.decisive_reason, /1Click Quoting is temporarily stopped/);
|
|
assert.match(normalized.decisive_reason, /Swaps are paused/);
|
|
});
|
|
|
|
test('resolved NEAR Intents status posts do not make the relay look disrupted', () => {
|
|
const normalized = normalizeNearIntentsStatus({
|
|
observedAt: '2026-04-16T13:00:00.000Z',
|
|
servicesResponse,
|
|
postEnumsResponse,
|
|
postsResponse: {
|
|
posts: [{
|
|
id: 'PM7LK6N',
|
|
title: '1Click Quoting is temporarily stopped',
|
|
post_type: 'incident',
|
|
latest_update: {
|
|
status_id: 'P8TG2TF',
|
|
severity_id: 'P187122',
|
|
reported_at: 1776346020000,
|
|
impacts: [{ service_id: 'PXQFSY1', severity_id: 'PCIGMKW' }],
|
|
message: '<p>Resolved.</p>',
|
|
},
|
|
}],
|
|
},
|
|
});
|
|
|
|
assert.equal(normalized.status, 'operational');
|
|
assert.equal(normalized.label, 'operational');
|
|
assert.equal(normalized.quoting_stopped, false);
|
|
assert.equal(normalized.current_incident_count, 0);
|
|
assert.match(normalized.decisive_reason, /no active incident/i);
|
|
});
|