feat(platform-web): show vehicle analysis scope
This commit is contained in:
@@ -938,6 +938,48 @@ test('applies protocol from shareable history hash to API requests', async () =>
|
||||
method: 'POST',
|
||||
body: expect.stringContaining('"protocol":"JT808"')
|
||||
}));
|
||||
expect(screen.getByText('当前车辆:粤AG18312')).toBeInTheDocument();
|
||||
expect(screen.getByText('当前来源:JT808')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('shows vehicle and source scope on mileage hash', async () => {
|
||||
window.history.replaceState(null, '', '/#/mileage?keyword=VIN-MILEAGE-001&protocol=GB32960');
|
||||
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, redisOnlineKeys: 0, tdengineWritable: true, mysqlWritable: true, runtime: { requestTimeoutMs: 5000 } },
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
if (path.includes('/api/mileage/summary')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: { vehicleCount: 1, recordCount: 2, sourceCount: 1, totalMileageKm: 12.3, averageMileagePerVin: 12.3 },
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: { items: [], total: 0, limit: 20, offset: 0 },
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
});
|
||||
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByText('当前车辆:VIN-MILEAGE-001')).toBeInTheDocument();
|
||||
expect(screen.getByText('当前来源:GB32960')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('keeps row protocol when opening vehicle service from history results', async () => {
|
||||
|
||||
Reference in New Issue
Block a user