feat(platform): add vehicle source fusion matrix

This commit is contained in:
lingniu
2026-07-04 21:48:51 +08:00
parent f0f7bc546e
commit e6d639572d
3 changed files with 211 additions and 3 deletions

View File

@@ -10100,6 +10100,11 @@ test('filters vehicle list by service status', async () => {
test('switches vehicle detail to a source from the source matrix', async () => {
window.history.replaceState(null, '', '/#/detail?keyword=VIN001');
const writeText = vi.fn(() => Promise.resolve());
Object.defineProperty(navigator, 'clipboard', {
configurable: true,
value: { writeText }
});
const fetchMock = vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
const path = String(input);
if (path.includes('/api/vehicle-service')) {
@@ -10194,10 +10199,20 @@ test('switches vehicle detail to a source from the source matrix', async () => {
expect(screen.getAllByText('GB32960 在线').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('JT808 在线').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('YUTONG_MQTT 未接入').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('多源归并矩阵')).toBeInTheDocument();
expect(screen.getByText('主实时来源')).toBeInTheDocument();
expect(screen.getAllByText('定位证据').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('统计口径').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('无实时字段')).toBeInTheDocument();
expect(screen.getByText('无 RAW 证据')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '复制归并矩阵' }));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【单车多源归并矩阵】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('1. GB32960 / 主来源'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('贡献主实时来源、在线心跳、实时字段、定位证据、轨迹回放、RAW证据、统计口径'));
expect(screen.getByText('车辆服务角色')).toBeInTheDocument();
expect(screen.getByText('主来源')).toBeInTheDocument();
expect(screen.getByText('在线证据')).toBeInTheDocument();
expect(screen.getByText('暂无来源')).toBeInTheDocument();
expect(screen.getAllByText('主来源').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('在线证据').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('暂无来源').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('最新位置')).toBeInTheDocument();
expect(screen.getAllByText('113.2, 23.1').length).toBeGreaterThan(0);
expect(screen.getAllByText(/100\s*km/).length).toBeGreaterThan(0);