agenthub/tests/boardV2.test.ts

37 lines
1.5 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import { renderBoardHtml } from '../src/server/board/index.js';
describe('renderBoardHtml (v2)', () => {
const html = renderBoardHtml('demo-project');
it('is a full html document with favicon and splash', () => {
expect(html).toMatch(/^<!doctype html>/i);
expect(html).toContain('rel="icon" href="/logo.svg"');
expect(html).toContain('id="b2-splash"');
});
it('contains header, kpis, columns and sidebar mount points', () => {
for (const s of ['b2-hdr', 'demo-project', 'id="kpiOpen"', 'id="b2Budget"', 'id="b2Feed"']) {
expect(html).toContain(s);
}
});
it('keeps the v1 interaction surface (dnd, sse, modals, budget reset)', () => {
for (const s of ['draggable', "new EventSource('/events')", 'task-log', 'budgetReset', 'taskModal']) {
expect(html).toContain(s);
}
});
it('renders in-progress cards with a progress ring and working glow', () => {
expect(html).toContain('b2-ring');
expect(html).toContain('b2-working');
});
it('does not ship the old v1 metric cards or lottie kpi icons', () => {
expect(html).not.toContain('metric-card');
expect(html).not.toContain('lottie');
});
it('runs the init sequence after all module definitions', () => {
const defIdx = html.indexOf('window.__b2UpdateKpis =');
const initIdx = html.indexOf('loadStatusMeta();');
expect(defIdx).toBeGreaterThan(-1);
expect(initIdx).toBeGreaterThan(defIdx);
});
});