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/); });