feat(platform): keep canonical source summary slots

This commit is contained in:
lingniu
2026-07-04 07:54:38 +08:00
parent 422ac684ed
commit 1d691306db
6 changed files with 72 additions and 5 deletions

View File

@@ -96,7 +96,11 @@ test('dashboard renders vehicle service summary metrics', async () => {
{ status: 'healthy', title: '服务正常', count: 161 },
{ status: 'degraded', title: '部分来源离线', count: 41 }
],
protocols: [{ protocol: 'JT808', online: 157, total: 388 }]
protocols: [
{ protocol: 'JT808', online: 157, total: 388 },
{ protocol: 'YUTONG_MQTT', online: 0, total: 0 }
],
missingSources: [{ protocol: 'YUTONG_MQTT', count: 1033 }]
},
traceId: 'trace-test',
timestamp: 1783094400000
@@ -116,7 +120,7 @@ test('dashboard renders vehicle service summary metrics', async () => {
render(<App />);
expect(await screen.findByText('总车辆')).toBeInTheDocument();
expect(screen.getByText('1,033')).toBeInTheDocument();
expect(screen.getAllByText('1,033').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('单源车辆')).toBeInTheDocument();
expect(screen.getByText('391')).toBeInTheDocument();
expect(screen.getByText('多源车辆')).toBeInTheDocument();
@@ -125,6 +129,9 @@ test('dashboard renders vehicle service summary metrics', async () => {
expect(screen.getByText('461')).toBeInTheDocument();
expect(screen.getByText('身份未绑定')).toBeInTheDocument();
expect(screen.getByText('来源证据在线分布')).toBeInTheDocument();
expect(screen.getByText('YUTONG_MQTT')).toBeInTheDocument();
expect(screen.getByText('0%')).toBeInTheDocument();
expect(screen.queryByText('NaN%')).not.toBeInTheDocument();
expect(fetchMock).toHaveBeenCalledWith('/api/vehicle-service/summary', undefined);
});