feat(platform): add vehicle service dossier

This commit is contained in:
lingniu
2026-07-04 22:17:41 +08:00
parent ea18a058ac
commit b3b4e2203a
3 changed files with 223 additions and 10 deletions

View File

@@ -248,7 +248,7 @@ test('shows vehicle service status distribution on dashboard', async () => {
render(<App />);
expect(await screen.findByText('车辆服务状态')).toBeInTheDocument();
expect(screen.getByText('来源不完整')).toBeInTheDocument();
expect(screen.getAllByText('来源不完整').length).toBeGreaterThan(0);
expect(screen.getByText('39')).toBeInTheDocument();
});
@@ -1664,7 +1664,7 @@ test('shows vehicle service result summary on vehicle list filters', async () =>
expect(screen.getByRole('button', { name: '补齐 YUTONG_MQTT 来源 181' })).toBeInTheDocument();
expect(screen.getByText('档案完整度')).toBeInTheDocument();
expect(screen.getByText('4/4')).toBeInTheDocument();
expect(screen.getByText('2/4')).toBeInTheDocument();
expect(screen.getAllByText('2/4').length).toBeGreaterThan(0);
expect(screen.getByText('缺OEM')).toBeInTheDocument();
expect(screen.getByText('VIN-MULTI-001')).toBeInTheDocument();
expect(screen.getByText('VIN-MISSING-ARCHIVE')).toBeInTheDocument();
@@ -9643,7 +9643,7 @@ test('shows vehicle service status in vehicle list', async () => {
expect(await screen.findByText('VIN-DEGRADED-001')).toBeInTheDocument();
expect(screen.getByText('车辆服务状态')).toBeInTheDocument();
expect(screen.getByText('来源不完整')).toBeInTheDocument();
expect(screen.getAllByText('来源不完整').length).toBeGreaterThan(0);
});
test('shows source consistency diagnosis in vehicle service list', async () => {
@@ -10278,7 +10278,7 @@ test('switches vehicle detail to a source from the source matrix', async () => {
render(<App />);
expect(await screen.findByText('VIN001')).toBeInTheDocument();
expect((await screen.findAllByText('VIN001')).length).toBeGreaterThan(0);
expect(screen.getAllByText('GB32960 在线').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('JT808 在线').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('YUTONG_MQTT 未接入').length).toBeGreaterThanOrEqual(1);
@@ -10375,8 +10375,16 @@ test('shows unified service overview on vehicle detail', async () => {
render(<App />);
expect(await screen.findByText('车辆服务概览')).toBeInTheDocument();
expect(screen.getByText('车辆服务档案总览')).toBeInTheDocument();
expect(screen.getByRole('button', { name: /复制档案/ })).toBeInTheDocument();
expect(screen.getByText('单车服务作业台')).toBeInTheDocument();
expect(screen.getByText('单车服务闭环Runbook')).toBeInTheDocument();
expect(screen.getAllByText('档案完整度').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('实时')).toBeInTheDocument();
expect(screen.getAllByText('轨迹').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('RAW').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('里程').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('告警').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('实时定位')).toBeInTheDocument();
expect(screen.getAllByText('轨迹回放').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('RAW 证据').length).toBeGreaterThan(0);
@@ -10880,6 +10888,19 @@ test('copies vehicle service diagnostic summary', async () => {
render(<App />);
expect(await screen.findByText('车辆服务结论')).toBeInTheDocument();
expect(screen.getByText('车辆服务档案总览')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: /复制档案/ }));
await waitFor(() => {
expect(writeText.mock.calls.some((call) => String(call[0]).includes('【车辆服务档案】'))).toBe(true);
});
const dossierCopied = String(writeText.mock.lastCall?.[0] ?? '');
expect(dossierCopied).toContain('【车辆服务档案】');
expect(dossierCopied).toContain('车辆粤A诊断1 / VIN-SUMMARY-001');
expect(dossierCopied).toContain('当前范围单一来源JT808');
expect(dossierCopied).toContain('主来源JT808');
expect(dossierCopied).toContain('来源在线1/2');
expect(dossierCopied).toContain('资产概览:实时 2 / 轨迹 12 / RAW 34 / 里程 3 / 告警 1');
expect(dossierCopied).toContain('车辆服务http://localhost:3000/#/detail?keyword=VIN-SUMMARY-001&protocol=JT808');
fireEvent.click(screen.getByRole('button', { name: /复制诊断摘要/ }));
await waitFor(() => {
@@ -11541,9 +11562,9 @@ test('shows selected source scope on vehicle detail', async () => {
render(<App />);
expect(await screen.findByText('当前查看范围')).toBeInTheDocument();
expect(screen.getByText('单一来源JT808')).toBeInTheDocument();
expect(screen.getAllByText('单一来源JT808').length).toBeGreaterThan(0);
expect(screen.getByText('车辆服务状态')).toBeInTheDocument();
expect(screen.getByText('来源不完整')).toBeInTheDocument();
expect(screen.getAllByText('来源不完整').length).toBeGreaterThan(0);
expect(fetchMock).toHaveBeenCalledWith(expect.stringContaining('/api/vehicle-service?keyword=VIN001&protocol=JT808'), undefined);
});
@@ -11940,10 +11961,10 @@ test('shows canonical vehicle archive on detail', async () => {
expect((await screen.findAllByText('车辆档案')).length).toBeGreaterThan(0);
expect(screen.getByText('车辆主键')).toBeInTheDocument();
expect(screen.getAllByText('VIN-ARCHIVE-001').length).toBeGreaterThan(0);
expect(screen.getByText('档案完整度')).toBeInTheDocument();
expect(screen.getByText('2/4')).toBeInTheDocument();
expect(screen.getByText('缺手机号')).toBeInTheDocument();
expect(screen.getByText('缺OEM')).toBeInTheDocument();
expect(screen.getAllByText('档案完整度').length).toBeGreaterThan(0);
expect(screen.getAllByText('2/4').length).toBeGreaterThan(0);
expect(screen.getAllByText('缺手机号').length).toBeGreaterThan(0);
expect(screen.getAllByText('缺OEM').length).toBeGreaterThan(0);
expect(screen.getByText('归并来源数')).toBeInTheDocument();
expect(screen.getAllByText('3').length).toBeGreaterThan(0);
});