40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { sidebarHtml, sidebarJs } from '../src/server/board/sidebar.js';
|
|
import { v1BudgetJs } from '../src/server/board/v1Budget.js';
|
|
|
|
describe('sidebarHtml', () => {
|
|
it('renders budget card with über-tabs and insight as default', () => {
|
|
const h = sidebarHtml();
|
|
expect(h).toContain('id="b2Budget"');
|
|
expect(h).toContain('data-otab="insight"');
|
|
expect(h).toContain('data-otab="verlauf"');
|
|
expect(h).toContain('id="budgetReset"');
|
|
expect(h).toContain('id="b2Feed"');
|
|
});
|
|
it('keeps the v1 budget mount points for the ported JS', () => {
|
|
const h = sidebarHtml();
|
|
expect(h).toContain('id="budgetRows"');
|
|
expect(h).toContain('id="budgetTotal"');
|
|
expect(h).toContain('data-budget-mode="session"');
|
|
expect(h).toContain('data-budget-mode="total"');
|
|
});
|
|
});
|
|
|
|
describe('sidebarJs', () => {
|
|
const js = sidebarJs(v1BudgetJs);
|
|
it('persists the über-tab and renders throughput', () => {
|
|
expect(js).toContain('agenthub-budget-otab'); // localStorage key
|
|
expect(js).toContain('function throughputSeries');
|
|
expect(js).toContain('function dayStart');
|
|
expect(js).toContain('__b2RenderThroughput');
|
|
expect(js).toContain('__b2FeedPush');
|
|
});
|
|
it('keeps v1 reset behaviour and session/total modes', () => {
|
|
expect(js).toContain('writeBaseline');
|
|
expect(js).toContain('agenthub-budget-mode');
|
|
expect(js).toContain('agenthub-donut-metric');
|
|
expect(js).toContain('budgetReset');
|
|
expect(js).toContain('renderBudget');
|
|
});
|
|
});
|