feat(platform): add customer map monitoring package

This commit is contained in:
lingniu
2026-07-05 03:08:58 +08:00
parent f4891525a6
commit 9d41c52cac
3 changed files with 193 additions and 3 deletions

View File

@@ -9034,6 +9034,11 @@ test('refreshes realtime vehicle data from the monitoring workspace', async () =
test('shows realtime freshness status for recently updated and stale vehicles', async () => {
window.history.replaceState(null, '', '/#/map');
const writeText = vi.fn(() => Promise.resolve());
Object.defineProperty(navigator, 'clipboard', {
configurable: true,
value: { writeText }
});
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
const path = String(input);
if (path.includes('/api/realtime/vehicles')) {
@@ -9104,11 +9109,17 @@ test('shows realtime freshness status for recently updated and stale vehicles',
expect(screen.getByText('实时盯车')).toBeInTheDocument();
expect(screen.getByText('异常优先')).toBeInTheDocument();
expect(screen.getAllByText('轨迹复盘').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('数据交付')).toBeInTheDocument();
expect(screen.getAllByText('数据交付').length).toBeGreaterThanOrEqual(1);
expect(screen.getByRole('button', { name: '地图监控任务 实时盯车 只看在线' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图监控任务 异常优先 关注车辆' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图监控任务 轨迹复盘 轨迹回放' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图监控任务 数据交付 导出当前页' })).toBeInTheDocument();
expect(screen.getByText('客户地图监控包')).toBeInTheDocument();
expect(screen.getByText('面向客户看图时,先确认车辆范围、在线态势、定位态势和选中车辆,再进入轨迹、里程、历史数据或告警通知。')).toBeInTheDocument();
expect(screen.getByText('车辆范围')).toBeInTheDocument();
expect(screen.getByText('在线态势')).toBeInTheDocument();
expect(screen.getByText('定位态势')).toBeInTheDocument();
expect(screen.getByRole('button', { name: /复制地图监控包/ })).toBeInTheDocument();
expect(screen.getByText('地图车辆作业台')).toBeInTheDocument();
expect(screen.getAllByText('粤A新鲜1').length).toBeGreaterThanOrEqual(1);
expect(screen.getByRole('button', { name: '地图车辆作业 车辆服务 车辆档案' })).toBeInTheDocument();
@@ -9116,9 +9127,15 @@ test('shows realtime freshness status for recently updated and stale vehicles',
expect(screen.getByRole('button', { name: '地图车辆作业 里程核对 查看里程' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图车辆作业 告警处置 查看告警' })).toBeInTheDocument();
expect(screen.getAllByText('关注车辆').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('选中车辆')).toBeInTheDocument();
expect(screen.getAllByText('选中车辆').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('车辆列表')).toBeInTheDocument();
expect(screen.getByText('1 辆更新超时')).toBeInTheDocument();
expect(screen.getAllByText('1 辆更新超时').length).toBeGreaterThanOrEqual(1);
fireEvent.click(screen.getByRole('button', { name: /复制地图监控包/ }));
await waitFor(() => {
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【客户地图监控包】'));
});
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('在线态势1 在线 / 1 离线'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆服务http://localhost:3000/#/detail?keyword=VIN-STALE-001&protocol=JT808'));
});
test('exports current realtime vehicles as CSV', async () => {