28 lines
1.4 KiB
TypeScript
28 lines
1.4 KiB
TypeScript
import { renderToStaticMarkup } from 'react-dom/server';
|
|
import { describe, expect, it } from 'vitest';
|
|
import { AiOverviewResultView } from '../../src/features/dashboard/AiOverviewPanel';
|
|
import { validAiOverviewResult } from '../fixtures/ai-overview';
|
|
import { readFileSync } from 'node:fs';
|
|
|
|
describe('Client Info AI Overview', () => {
|
|
it('renders every section of the validated output contract as text', () => {
|
|
const html = renderToStaticMarkup(<AiOverviewResultView
|
|
result={validAiOverviewResult()} generatedAt="2026-09-14T08:00:00.000Z" model="work-model" />);
|
|
for (const heading of ['Executive summary', 'Environment overview', 'Security themes', 'Priorities',
|
|
'Five-phase roadmap', 'Coverage gaps', 'Quick wins', 'Questions', 'Assumptions']) {
|
|
expect(html).toContain(heading);
|
|
}
|
|
expect(html).toContain('Synthetic executive summary.');
|
|
expect(html).toContain('RULE-1');
|
|
expect(html).toContain('Advisory AI output');
|
|
});
|
|
|
|
it('adds the AI tab beside the Client Info overview', () => {
|
|
const dashboard = readFileSync(new URL('../../src/features/dashboard/DashboardPanel.tsx', import.meta.url), 'utf8');
|
|
expect(dashboard).toContain("['overview', 'Overview'] as const,");
|
|
expect(dashboard).toContain('{clientInfoTabs}');
|
|
expect(dashboard).toContain("...(showAiOverview ? [['ai', 'AI Overview'] as const] : [])");
|
|
expect(dashboard).toContain("clientInfoView === 'ai'");
|
|
});
|
|
});
|