feat(platform): add vehicle dispatch checklist

This commit is contained in:
lingniu
2026-07-04 20:03:56 +08:00
parent 259601ed7b
commit 06d9dc1562
2 changed files with 74 additions and 1 deletions

View File

@@ -10,6 +10,15 @@ afterEach(() => {
});
test('renders vehicle platform shell', () => {
vi.spyOn(globalThis, 'fetch').mockImplementation(async () => ({
ok: true,
json: async () => ({
data: { items: [], total: 0, limit: 20, offset: 0, linkHealth: [], runtime: { requestTimeoutMs: 5000 } },
traceId: 'trace-test',
timestamp: 1783094400000
})
}) as Response);
render(<App />);
expect(screen.getByText('车辆服务中台')).toBeInTheDocument();
expect(screen.getByText('一车一服务 / 多源归并')).toBeInTheDocument();
@@ -125,7 +134,7 @@ test('exposes AMap operations shortcuts when map key is configured', async () =>
render(<App />);
expect(await screen.findByText('地图就绪')).toBeInTheDocument();
expect(screen.getByText((content) => content.includes('platform-20260704153357'))).toBeInTheDocument();
expect(await screen.findByText((content) => content.includes('platform-20260704153357'))).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '顶部地图态势' }));
expect(window.location.hash).toBe('#/map');
expect(await screen.findByRole('heading', { name: '实时地图' })).toBeInTheDocument();
@@ -1749,6 +1758,19 @@ test('copies vehicle governance summary from vehicle center', async () => {
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('处置队列:'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('[P0] 维护身份绑定 4'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('[P1] 补齐 YUTONG_MQTT 来源 8'));
fireEvent.click(screen.getByRole('button', { name: '复制当前页处置清单' }));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【车辆处置清单】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('当前筛选缺失来源YUTONG_MQTT'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('当前页1 辆 / 总计 12 辆'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('1. 车牌 粤A治理1 / VIN VIN-GOV-001 / 手机号 - / OEM G7s'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('状态来源不完整在线在线来源1/1 来源在线,缺 YUTONG_MQTT最后时间2026-07-03 20:12:10'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('建议动作:补齐 YUTONG_MQTT 来源'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆服务http://localhost:3000/#/detail?keyword=VIN-GOV-001&protocol=JT808'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('实时监控http://localhost:3000/#/realtime?keyword=VIN-GOV-001&protocol=JT808'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('轨迹回放http://localhost:3000/#/history?keyword=VIN-GOV-001&protocol=JT808'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('告警事件http://localhost:3000/#/alert-events?keyword=VIN-GOV-001&protocol=JT808'));
});
test('filters vehicle list from recommended action', async () => {