feat(platform): link vehicle center workflows
This commit is contained in:
@@ -9327,13 +9327,81 @@ test('opens vehicle service from source-filtered vehicle list with source eviden
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByText('VIN-LIST-JT808')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button', { name: '车辆服务' }));
|
||||
fireEvent.click(screen.getByRole('button', { name: '服务' }));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(window.location.hash).toBe('#/detail?keyword=VIN-LIST-JT808&protocol=JT808');
|
||||
});
|
||||
});
|
||||
|
||||
test('opens realtime and trajectory from vehicle center row', async () => {
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||
const path = String(input);
|
||||
if (path.includes('/api/vehicles/coverage')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: {
|
||||
items: [{
|
||||
vin: 'VIN-LIST-WORKFLOW',
|
||||
plate: '粤A列表流',
|
||||
phone: '13307795425',
|
||||
oem: 'G7s',
|
||||
protocols: ['GB32960', 'JT808'],
|
||||
missingProtocols: [],
|
||||
sourceStatus: [
|
||||
{ protocol: 'GB32960', online: false, lastSeen: '2026-07-03 18:12:10', hasRealtime: true, hasHistory: true, hasRaw: true, hasMileage: true },
|
||||
{ protocol: 'JT808', online: true, lastSeen: '2026-07-03 20:12:10', hasRealtime: true, hasHistory: true, hasRaw: true, hasMileage: true }
|
||||
],
|
||||
sourceCount: 2,
|
||||
onlineSourceCount: 1,
|
||||
online: true,
|
||||
lastSeen: '2026-07-03 20:12:10',
|
||||
bindingStatus: 'bound'
|
||||
}],
|
||||
total: 1,
|
||||
limit: 20,
|
||||
offset: 0
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: path.includes('/api/ops/health')
|
||||
? { linkHealth: [], kafkaLag: 0, redisOnlineKeys: 0, tdengineWritable: true, mysqlWritable: true, runtime: { requestTimeoutMs: 5000 } }
|
||||
: { items: [], total: 0, limit: 20, offset: 0 },
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
});
|
||||
|
||||
window.history.replaceState(null, '', '/#/vehicles');
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByText('VIN-LIST-WORKFLOW')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button', { name: '实时' }));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(window.location.hash).toBe('#/realtime?keyword=VIN-LIST-WORKFLOW&protocol=JT808');
|
||||
});
|
||||
|
||||
cleanup();
|
||||
window.history.replaceState(null, '', '/#/vehicles');
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByText('VIN-LIST-WORKFLOW')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button', { name: '轨迹' }));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(window.location.hash).toBe('#/history?keyword=VIN-LIST-WORKFLOW&protocol=JT808');
|
||||
});
|
||||
});
|
||||
|
||||
test('opens quality issues from source-filtered vehicle list with source evidence', async () => {
|
||||
window.history.replaceState(null, '', '/#/vehicles?protocol=JT808');
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||
@@ -9429,7 +9497,7 @@ test('opens quality issues from source-filtered vehicle list with source evidenc
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByText('VIN-LIST-QUALITY')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button', { name: '质量问题' }));
|
||||
fireEvent.click(screen.getByRole('button', { name: '告警' }));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(window.location.hash).toBe('#/alert-events?keyword=VIN-LIST-QUALITY&protocol=JT808');
|
||||
|
||||
Reference in New Issue
Block a user