feat(platform): expose vehicle operations shortcuts

This commit is contained in:
lingniu
2026-07-04 14:14:06 +08:00
parent 67ebf89db9
commit d6c2edce7e
2 changed files with 49 additions and 6 deletions

View File

@@ -29,6 +29,36 @@ test('exposes AMap operations shortcuts when map key is configured', async () =>
})
} as Response;
}
if (path.includes('/api/mileage/summary')) {
return {
ok: true,
json: async () => ({
data: { vehicleCount: 0, recordCount: 0, sourceCount: 0, totalMileageKm: 0, averageMileagePerVin: 0 },
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
}
if (path.includes('/api/quality/summary')) {
return {
ok: true,
json: async () => ({
data: { issueVehicleCount: 0, issueRecordCount: 0, errorCount: 0, warningCount: 0, protocols: [], issueTypes: [] },
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
}
if (path.includes('/api/quality/notification-plan')) {
return {
ok: true,
json: async () => ({
data: { rules: [], policies: [], priorityIssues: [], activeRuleCount: 0, p0RuleCount: 0 },
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
}
return {
ok: true,
json: async () => ({
@@ -42,10 +72,16 @@ test('exposes AMap operations shortcuts when map key is configured', async () =>
render(<App />);
expect(await screen.findByText('地图就绪')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '实时地图' }));
fireEvent.click(screen.getByRole('button', { name: '顶部实时监控' }));
expect(window.location.hash).toBe('#/realtime');
fireEvent.click(screen.getByRole('button', { name: '地图回放' }));
fireEvent.click(screen.getByRole('button', { name: '顶部轨迹回放' }));
expect(window.location.hash.startsWith('#/history')).toBe(true);
fireEvent.click(screen.getByRole('button', { name: '顶部历史查询' }));
expect(window.location.hash.startsWith('#/history')).toBe(true);
fireEvent.click(screen.getByRole('button', { name: '顶部统计查询' }));
expect(window.location.hash.startsWith('#/mileage')).toBe(true);
fireEvent.click(await screen.findByRole('button', { name: '顶部告警通知正常' }));
expect(window.location.hash).toBe('#/quality');
});
test('shows vehicle service status distribution on dashboard', async () => {