import assert from 'node:assert/strict'; global.window = {PYTORRENT_DISABLE_AUTOSTART: true}; const app = await import('../pytorrent/static/js/app.js'); const source = app.buildRuntimeSource(); assert.equal(app.moduleSources.length, 18, 'all frontend module chunks are loaded'); assert.doesNotThrow(() => Function('io', source), 'assembled frontend runtime compiles'); for (const marker of [ 'function renderRow', 'function renderTable', 'function scheduleRender', 'async function post', 'async function loadRss', 'async function loadSmartQueue', 'function ensurePlannerToolsUI', 'function loadPlannerPreview', 'function pollerPayload', 'function pollerDiagnostics', 'function renderHealthDashboard', 'function recordNotification', 'function drawTrafficHistory', "socket.on('connect'", '/api/download-planner/preview', 'plannerProfileName', 'pollerTorrentList', ]) { assert.ok(source.includes(marker), `runtime contains ${marker}`); } function extractFunction(src, name){ const start = src.indexOf(`function ${name}`); assert.ok(start >= 0, `found function ${name}`); const open = src.indexOf('{', start); let depth = 0; for(let i=open; i&"'), '<tag>&"', 'esc escapes HTML'); assert.ok(renderHarness.progressBar(42).includes('42%'), 'progressBar renders percentage'); assert.ok(renderHarness.compactCell('x'.repeat(200)).includes('title='), 'compactCell renders title for long text'); assert.ok(renderHarness.table(['A'], [['B']]).includes('