43 lines
1.7 KiB
TypeScript
43 lines
1.7 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 ['app-header', '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('gives review cards the same ring design (amber variant)', () => {
|
|
expect(html).toContain('b2-ring-review');
|
|
});
|
|
it('sizes card grid rows to content (overlap regression)', () => {
|
|
expect(html).toContain('grid-auto-rows: max-content');
|
|
});
|
|
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);
|
|
});
|
|
});
|