feat(platform): expose missing vehicle source slots

This commit is contained in:
lingniu
2026-07-04 05:21:54 +08:00
parent ff74375c45
commit d51c83db2a
3 changed files with 75 additions and 5 deletions

View File

@@ -1795,7 +1795,7 @@ test('filters vehicle list by service status', async () => {
});
});
test('switches vehicle detail to a source from the coverage cards', async () => {
test('switches vehicle detail to a source from the source matrix', async () => {
window.history.replaceState(null, '', '/#/detail?keyword=VIN001');
const fetchMock = vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
const path = String(input);
@@ -1839,7 +1839,7 @@ test('switches vehicle detail to a source from the coverage cards', async () =>
sourceStatus: [
{ protocol: 'GB32960', online: true, lastSeen: '2026-07-03 20:12:10', hasRealtime: true, hasHistory: true, hasRaw: true, hasMileage: true },
{ 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: '2026-07-03 20:10:00', hasRealtime: true, hasHistory: false, hasRaw: true, hasMileage: false }
{ protocol: 'YUTONG_MQTT', online: false, lastSeen: '', hasRealtime: false, hasHistory: false, hasRaw: false, hasMileage: false }
],
realtime: [],
history: { items: [], total: 0, limit: 20, offset: 0 },
@@ -1869,6 +1869,8 @@ test('switches vehicle detail to a source from the coverage cards', async () =>
expect(screen.getByText('主来源')).toBeInTheDocument();
expect(screen.getByText('在线证据')).toBeInTheDocument();
expect(screen.getByText('离线证据')).toBeInTheDocument();
expect(screen.getAllByText('YUTONG_MQTT').length).toBeGreaterThan(0);
expect(screen.getAllByText('无上报').length).toBeGreaterThan(0);
fireEvent.click(screen.getByRole('button', { name: '仅看 JT808' }));
await waitFor(() => {