34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { kpiSkeletonHtml, kpiJs } from '../src/server/board/kpis.js';
|
|
|
|
describe('kpiSkeletonHtml', () => {
|
|
it('renders the four KPI cards with stable ids', () => {
|
|
const h = kpiSkeletonHtml();
|
|
for (const id of ['kpiOpen', 'kpiInProgress', 'kpiReview', 'kpiDone']) {
|
|
expect(h).toContain(`id="${id}"`);
|
|
}
|
|
expect(h).toContain('Open');
|
|
expect(h).toContain('In Progress');
|
|
expect(h).toContain('Review');
|
|
expect(h).toContain('Done');
|
|
});
|
|
});
|
|
|
|
describe('kpiJs', () => {
|
|
it('injects the pure helpers and an updateKpis entry point', () => {
|
|
const js = kpiJs();
|
|
for (const fn of ['capChips', 'doneStats', 'backlogSeries', 'areaPath', 'laneChips']) {
|
|
expect(js).toContain(`function ${fn}`);
|
|
}
|
|
expect(js).toContain('window.__b2UpdateKpis');
|
|
});
|
|
it('co-injects the shared constants the helpers depend on', () => {
|
|
const js = kpiJs();
|
|
expect(js).toContain('DAY_MS');
|
|
expect(js).toContain('function dayStart');
|
|
});
|
|
it('keeps chips single-line friendly (no wide text prefix)', () => {
|
|
expect(kpiJs()).not.toContain('prüft ');
|
|
});
|
|
});
|