feat(platform-web): link analysis pages to vehicle service
This commit is contained in:
@@ -398,3 +398,48 @@ test('opens history with the currently selected vehicle detail source', async ()
|
||||
expect(window.location.hash).toBe('#/history?keyword=VIN001&protocol=JT808');
|
||||
});
|
||||
});
|
||||
|
||||
test('opens vehicle service from an empty history query with the current filters', async () => {
|
||||
window.history.replaceState(null, '', '/#/history?keyword=VIN404&protocol=JT808');
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||
const path = String(input);
|
||||
if (path.includes('/api/vehicles/resolve')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: {
|
||||
lookupKey: 'VIN404',
|
||||
resolved: true,
|
||||
vin: 'VIN404',
|
||||
plate: '',
|
||||
phone: '',
|
||||
oem: '',
|
||||
protocols: ['JT808'],
|
||||
online: false,
|
||||
lastSeen: ''
|
||||
},
|
||||
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: 10, offset: 0 },
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
});
|
||||
|
||||
render(<App />);
|
||||
|
||||
fireEvent.click(await screen.findByRole('button', { name: '当前车辆服务' }));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(window.location.hash).toBe('#/detail?keyword=VIN404&protocol=JT808');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user