feat(platform): prioritize customer vehicle service path

This commit is contained in:
lingniu
2026-07-06 04:15:21 +08:00
parent 6b9f269b89
commit ad644d43b1
3 changed files with 272 additions and 0 deletions

View File

@@ -71,6 +71,90 @@ test('renders vehicle platform shell', () => {
expect(getComputedStyle(document.body).minWidth).not.toBe('1280px');
});
test('dashboard opens with a customer vehicle service path instead of protocol entry points', async () => {
window.history.replaceState(null, '', '/#/dashboard');
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
const path = String(input);
if (path.includes('/api/ops/health')) {
return {
ok: true,
json: async () => ({
data: {
linkHealth: [],
kafkaLag: 0,
activeConnections: 15,
redisOnlineKeys: 92,
tdengineWritable: true,
mysqlWritable: true,
runtime: { requestTimeoutMs: 5000, amapWebJsConfigured: true, amapSecurityProxyEnabled: true, amapSecurityCodeExposed: false }
},
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
}
if (path.includes('/api/dashboard/summary')) {
return {
ok: true,
json: async () => ({
data: {
onlineVehicles: 92,
activeToday: 120,
frameToday: 21000,
issueVehicles: 7,
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: 1033,
boundVehicles: 988,
onlineVehicles: 92,
singleSourceVehicles: 170,
multiSourceVehicles: 220,
noDataVehicles: 15,
identityRequiredVehicles: 9,
serviceStatuses: [],
protocols: [],
missingSources: []
},
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
}
return {
ok: true,
json: async () => ({
data: { items: [], total: 0, limit: 8, offset: 0 },
traceId: 'trace-test',
timestamp: 1783094400000
})
} as Response;
});
render(<App />);
expect(await screen.findByRole('heading', { name: '客户车辆服务路径' })).toBeInTheDocument();
expect(screen.getByText('客户入口只回答车辆问题:在线在哪里、这段时间怎么跑、里程是否可信、异常是否通知、数据能否交付。')).toBeInTheDocument();
expect(screen.getByText('32960 / 808 / MQTT 只是证据通道')).toBeInTheDocument();
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.getByRole('button', { name: '客户车辆服务路径 数据导出 数据能否交付 导出证据' })).toBeInTheDocument();
});
test('topbar frames customer work as a vehicle service delivery strip', () => {
vi.spyOn(globalThis, 'fetch').mockImplementation(async () => ({
ok: true,