unrip/test/operator-dashboard-app-static.test.mjs
philipp 266d149b33
Some checks failed
deploy / deploy (push) Failing after 39s
Show full imported asset catalog
Proof: npm test passed 166/166; npm run operator-dashboard:build passed; focused dashboard static tests cover removing the 20-row asset registry cap and requesting 250 catalog rows.

Assumptions: Current 1Click import has 163 supported tokens, so a 250-row dashboard catalog cap exposes the full current catalog while keeping the bootstrap bounded.

Still fake: no live funds movement; imported assets remain catalog-visible only unless explicitly inventory/trading enabled.
2026-05-12 22:52:50 +02:00

21 lines
1 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*\}\)/);
});