46 lines
1.8 KiB
TypeScript
46 lines
1.8 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 without über-tabs (tabs live in the donut card)', () => {
|
|
const h = sidebarHtml();
|
|
expect(h).toContain('id="b2Budget"');
|
|
expect(h).not.toContain('data-otab');
|
|
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('renders throughput and feed without über-tab logic', () => {
|
|
expect(js).not.toContain('agenthub-budget-otab');
|
|
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');
|
|
});
|
|
it('hosts the three tabs Token/Kosten/Verlauf inside the donut card', () => {
|
|
expect(js).toContain('data-donut-tab="tokens"');
|
|
expect(js).toContain('data-donut-tab="cost"');
|
|
expect(js).toContain('data-donut-tab="verlauf"');
|
|
expect(js).toContain('donutTabsHtml');
|
|
expect(js).toContain('donutCardShell');
|
|
});
|
|
});
|