feat(platform): link quality issues to raw evidence
This commit is contained in:
@@ -2589,6 +2589,100 @@ test('opens same-day history evidence from quality issue row', async () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('opens same-day raw evidence from quality issue row', async () => {
|
||||
window.history.replaceState(null, '', '/#/quality');
|
||||
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/quality/summary')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: {
|
||||
issueVehicleCount: 1,
|
||||
issueRecordCount: 1,
|
||||
errorCount: 0,
|
||||
warningCount: 1,
|
||||
protocols: [{ name: 'GB32960', count: 1 }],
|
||||
issueTypes: [{ name: 'FIELD_MISSING', count: 1 }]
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
if (path.includes('/api/quality/issues')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: {
|
||||
items: [{
|
||||
vin: 'VIN-QUALITY-RAW',
|
||||
plate: '粤A告警RAW',
|
||||
phone: '',
|
||||
sourceEndpoint: '115.29.187.205:32960',
|
||||
protocol: 'GB32960',
|
||||
issueType: 'FIELD_MISSING',
|
||||
severity: 'warning',
|
||||
lastSeen: '2026-07-03 20:12:10',
|
||||
detail: 'GB32960 实时帧缺少氢耗字段'
|
||||
}],
|
||||
total: 1,
|
||||
limit: 20,
|
||||
offset: 0
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
} as Response;
|
||||
}
|
||||
if (path.includes('/api/history/locations') || path.includes('/api/history/raw-frames')) {
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: { items: [], total: 0, limit: 10, offset: 0 },
|
||||
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-QUALITY-RAW')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button', { name: '核对 RAW' }));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(window.location.hash.startsWith('#/history?')).toBe(true);
|
||||
});
|
||||
const params = new URLSearchParams(window.location.hash.slice('#/history?'.length));
|
||||
expect(params.get('keyword')).toBe('VIN-QUALITY-RAW');
|
||||
expect(params.get('protocol')).toBe('GB32960');
|
||||
expect(params.get('dateFrom')).toBe('2026-07-03');
|
||||
expect(params.get('dateTo')).toBe('2026-07-04');
|
||||
expect(params.get('includeFields')).toBe('true');
|
||||
expect(params.get('tab')).toBe('raw');
|
||||
expect(await screen.findByRole('heading', { name: '轨迹回放' })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('opens same-day mileage statistics from quality issue row', async () => {
|
||||
window.history.replaceState(null, '', '/#/quality');
|
||||
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
|
||||
|
||||
Reference in New Issue
Block a user