Some checks failed
deploy / deploy (push) Failing after 30s
Proof: npm test; npm run operator-dashboard:build; focused regressions cover maker/taker activation creating config, invalid initial edge rejection, and invalid max-notional rejection. Assumptions: Adding maker/taker/both mode should create an initial pair strategy config with operator-provided edge and max notional, but pairs without a real price route must remain blocked. Still fake: No BTC/USDC external reference price route or liquidity model exists; non-nBTC/EURe pairs still fail closed on missing price route until that path is built.
30 lines
1.4 KiB
JavaScript
30 lines
1.4 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
|
|
const source = readFileSync(new URL('../src/apps/operator-dashboard.mjs', import.meta.url), 'utf8');
|
|
|
|
test('operator dashboard awaits API handler promises so request errors reach the top-level catch', () => {
|
|
assert.equal(source.includes('return await handleApiRequest({ req, res, url, auth });'), true);
|
|
assert.equal(source.includes('return handleApiRequest({ req, res, url, auth });'), false);
|
|
});
|
|
|
|
test('operator dashboard control proxy catches upstream failures before sending JSON response', () => {
|
|
assert.match(source, /dashboard_control_failed/);
|
|
assert.match(source, /buildDashboardControlErrorResponse/);
|
|
assert.match(source, /failure.statusCode/);
|
|
});
|
|
|
|
test('operator dashboard requests enough asset catalog rows for the current 1Click import', () => {
|
|
assert.match(source, /loadAssetCatalogSummary\(pool,\s*\{\s*limit:\s*250\s*\}\)/);
|
|
assert.doesNotMatch(source, /loadAssetCatalogSummary\(pool,\s*\{\s*limit:\s*80\s*\}\)/);
|
|
});
|
|
|
|
test('operator dashboard exposes DB-backed pair activation and pause controls', () => {
|
|
assert.match(source, /setTradingPairMode/);
|
|
assert.match(source, /pauseTradingPair/);
|
|
assert.match(source, /control\.action === 'set-pair-mode'/);
|
|
assert.match(source, /control\.action === 'pause-pair'/);
|
|
assert.match(source, /edgeBps: body\.edge_bps/);
|
|
assert.match(source, /maxNotional: body\.max_notional/);
|
|
});
|