feat(platform): diagnose source consistency

This commit is contained in:
lingniu
2026-07-04 04:12:23 +08:00
parent 7b801b6f71
commit e077d99a5e
9 changed files with 104 additions and 5 deletions

View File

@@ -386,7 +386,11 @@ test('shows resolved vehicle service status after topbar search', async () => {
locatedSourceCount: 2,
mileageDeltaKm: 0,
sourceTimeDeltaSeconds: 0,
scope: 'all_sources'
scope: 'all_sources',
status: 'degraded',
severity: 'warning',
title: '部分来源离线',
detail: '1/2 个来源在线,车辆服务可用但需要关注离线来源。'
}
},
traceId: 'trace-test',
@@ -432,7 +436,7 @@ test('shows resolved vehicle service status after topbar search', async () => {
expect(await screen.findByText('当前车辆:后端判定部分离线')).toBeInTheDocument();
expect(screen.getByText('粤AG18312 / LB9A32A24R0LS1426')).toBeInTheDocument();
expect(screen.getByText('一致性:1/2 来源')).toBeInTheDocument();
expect(screen.getByText('一致性:部分来源离线')).toBeInTheDocument();
expect(fetchMock).toHaveBeenCalledWith(expect.stringContaining('/api/vehicle-service/overview?keyword=%E7%B2%A4AG18312'), undefined);
expect(fetchMock).not.toHaveBeenCalledWith(expect.stringContaining('/api/vehicles/resolve'), undefined);
});
@@ -1777,7 +1781,11 @@ test('shows cross-source consistency for one vehicle service', async () => {
locatedSourceCount: 3,
mileageDeltaKm: 0.4,
sourceTimeDeltaSeconds: 35,
scope: 'all_sources'
scope: 'all_sources',
status: 'degraded',
severity: 'warning',
title: '部分来源离线',
detail: '2/3 个来源在线,车辆服务可用但需要关注离线来源。'
},
sources: ['GB32960', 'JT808', 'YUTONG_MQTT'],
sourceStatus: [
@@ -1815,6 +1823,8 @@ test('shows cross-source consistency for one vehicle service', async () => {
render(<App />);
expect(await screen.findByText('跨来源一致性')).toBeInTheDocument();
expect(screen.getAllByText('部分来源离线').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('2/3 个来源在线,车辆服务可用但需要关注离线来源。')).toBeInTheDocument();
expect(screen.getByText('3 个来源')).toBeInTheDocument();
expect(screen.getByText('2/3 在线')).toBeInTheDocument();
expect(screen.getByText('3 个来源有位置')).toBeInTheDocument();