feat(platform): expose capacity check findings

This commit is contained in:
lingniu
2026-07-04 08:58:40 +08:00
parent e29f8768ca
commit f651e48434
6 changed files with 69 additions and 5 deletions

View File

@@ -4153,6 +4153,31 @@ test('quality health shows active connection capacity metric', async () => {
expect(screen.getByText('120,000')).toBeInTheDocument();
});
test('quality health shows structured capacity findings', async () => {
window.history.replaceState(null, '', '/#/quality');
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
const path = String(input);
return {
ok: true,
json: async () => ({
data: path.includes('/api/ops/health')
? { linkHealth: [], kafkaLag: 42, activeConnections: 120000, capacityFindings: ['kafka lag 42'], redisOnlineKeys: 368, tdengineWritable: true, mysqlWritable: true, runtime: { requestTimeoutMs: 5000 } }
: path.includes('/api/quality/summary')
? { issueVehicleCount: 0, issueRecordCount: 0, errorCount: 0, warningCount: 0, protocols: [], issueTypes: [] }
: { items: [], total: 0, limit: 20, offset: 0 },
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
});
render(<App />);
expect(await screen.findByRole('heading', { name: '质量治理' })).toBeInTheDocument();
expect(await screen.findByText('容量检查发现')).toBeInTheDocument();
expect(screen.getByText('kafka lag 42')).toBeInTheDocument();
});
test('shows vehicle service evidence chain before source details', async () => {
window.history.replaceState(null, '', '/#/detail?keyword=VIN001');
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {