feat(platform): enrich vehicle source evidence matrix

This commit is contained in:
lingniu
2026-07-04 10:06:43 +08:00
parent 7925be676b
commit e59e5f7c11
2 changed files with 62 additions and 2 deletions

View File

@@ -4337,7 +4337,30 @@ test('switches vehicle detail to a source from the source matrix', async () => {
{ protocol: 'JT808', online: true, lastSeen: '2026-07-03 20:12:08', hasRealtime: true, hasHistory: true, hasRaw: true, hasMileage: true },
{ protocol: 'YUTONG_MQTT', online: false, lastSeen: '', hasRealtime: false, hasHistory: false, hasRaw: false, hasMileage: false }
],
realtime: [],
realtime: [
{
vin: 'VIN001',
plate: '粤AG18312',
protocol: 'GB32960',
longitude: 113.2,
latitude: 23.1,
speedKmh: 30,
socPercent: 78,
totalMileageKm: 100,
lastSeen: '2026-07-03 20:12:10'
},
{
vin: 'VIN001',
plate: '粤AG18312',
protocol: 'JT808',
longitude: 113.21,
latitude: 23.11,
speedKmh: 28,
socPercent: 0,
totalMileageKm: 99.5,
lastSeen: '2026-07-03 20:12:08'
}
],
history: { items: [], total: 0, limit: 20, offset: 0 },
raw: { items: [], total: 0, limit: 10, offset: 0 },
mileage: { items: [], total: 0, limit: 20, offset: 0 },
@@ -4368,6 +4391,10 @@ test('switches vehicle detail to a source from the source matrix', async () => {
expect(screen.getByText('主来源')).toBeInTheDocument();
expect(screen.getByText('在线证据')).toBeInTheDocument();
expect(screen.getByText('暂无来源')).toBeInTheDocument();
expect(screen.getByText('最新位置')).toBeInTheDocument();
expect(screen.getAllByText('113.2, 23.1').length).toBeGreaterThan(0);
expect(screen.getByText(/100\s*km/)).toBeInTheDocument();
expect(screen.getByText(/30\s*km\/h/)).toBeInTheDocument();
expect(screen.getAllByText('YUTONG_MQTT').length).toBeGreaterThan(0);
expect(screen.getAllByText('无上报').length).toBeGreaterThan(0);
fireEvent.click(screen.getByRole('button', { name: '仅看 JT808' }));