feat(platform): add operations handoff summary

This commit is contained in:
lingniu
2026-07-04 19:57:33 +08:00
parent b0451982a1
commit 259601ed7b
2 changed files with 88 additions and 0 deletions

View File

@@ -40,6 +40,48 @@ test('exposes AMap operations shortcuts when map key is configured', async () =>
})
} as Response;
}
if (path.includes('/api/dashboard/summary')) {
return {
ok: true,
json: async () => ({
data: {
onlineVehicles: 0,
activeToday: 0,
frameToday: 0,
issueVehicles: 0,
kafkaLag: 0,
protocols: [],
serviceStatuses: [],
linkHealth: []
},
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
}
if (path.includes('/api/vehicle-service/summary')) {
return {
ok: true,
json: async () => ({
data: {
totalVehicles: 0,
boundVehicles: 0,
onlineVehicles: 0,
singleSourceVehicles: 0,
multiSourceVehicles: 0,
noDataVehicles: 0,
identityRequiredVehicles: 0,
archiveIncompleteVehicles: 0,
serviceStatuses: [],
protocols: [],
missingSources: [],
archiveMissingFields: []
},
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
}
if (path.includes('/api/mileage/summary')) {
return {
ok: true,
@@ -1170,6 +1212,23 @@ test('dashboard copies highest priority quality issue notification text', async
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('详情JT808 数据缺少 VIN 映射'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('轨迹证据http://localhost:3000/#/history?keyword=%E7%B2%A4A%E5%91%8A%E8%AD%A61&protocol=JT808&dateFrom=2026-07-03&dateTo=2026-07-04'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('RAW证据http://localhost:3000/#/history-query?keyword=%E7%B2%A4A%E5%91%8A%E8%AD%A61&protocol=JT808&tab=raw&dateFrom=2026-07-03&dateTo=2026-07-04&includeFields=true'));
fireEvent.click(screen.getByRole('button', { name: '复制运营交接摘要' }));
await waitFor(() => {
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【车辆数据中台运营交接摘要】'));
});
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('在线车辆88 / 1,033'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('今日活跃96'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('今日帧量1,286,320'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('Kafka Lag0'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('最高告警P0 VIN 缺失 / 粤A告警1 / 13307795425 / 2026-07-03 20:12:10'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('实时监控http://localhost:3000/#/realtime?online=online'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('实时地图http://localhost:3000/#/map?online=online'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('轨迹回放http://localhost:3000/#/history?keyword=%E7%B2%A4A%E5%91%8A%E8%AD%A61&protocol=JT808&dateFrom=2026-07-03&dateTo=2026-07-04'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('历史RAWhttp://localhost:3000/#/history-query?keyword=%E7%B2%A4A%E5%91%8A%E8%AD%A61&protocol=JT808&tab=raw&dateFrom=2026-07-03&dateTo=2026-07-04&includeFields=true'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('告警事件http://localhost:3000/#/alert-events?issueType=VIN_MISSING'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆服务http://localhost:3000/#/detail?keyword=%E7%B2%A4A%E5%91%8A%E8%AD%A61&protocol=JT808'));
});
test('dashboard keeps core vehicle service metrics when preview requests fail', async () => {