From 77c5730e770a4ba37c687f7dd230d1fb42a67c18 Mon Sep 17 00:00:00 2001 From: lingniu Date: Mon, 6 Jul 2026 04:40:17 +0800 Subject: [PATCH] feat(platform): frame navigation around vehicle monitoring --- .../apps/web/src/layout/AppShell.tsx | 6 ++--- .../apps/web/src/test/App.test.tsx | 25 ++++++++++++++++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/vehicle-data-platform/apps/web/src/layout/AppShell.tsx b/vehicle-data-platform/apps/web/src/layout/AppShell.tsx index 02189d65..499bc052 100644 --- a/vehicle-data-platform/apps/web/src/layout/AppShell.tsx +++ b/vehicle-data-platform/apps/web/src/layout/AppShell.tsx @@ -29,11 +29,11 @@ export type CustomerView = { const navGroups = [ { - title: '实时运营', + title: '车辆监控', audience: '客户', - description: '地图看车、在线监控、异常优先', + description: '地图看车、实时状态、异常优先', items: [ - { itemKey: 'dashboard', text: '运营总览', icon: }, + { itemKey: 'dashboard', text: '车辆总览', icon: }, { itemKey: 'map', text: '实时地图', icon: }, { itemKey: 'realtime', text: '实时监控', icon: } ] diff --git a/vehicle-data-platform/apps/web/src/test/App.test.tsx b/vehicle-data-platform/apps/web/src/test/App.test.tsx index a224bea6..e05d7d75 100644 --- a/vehicle-data-platform/apps/web/src/test/App.test.tsx +++ b/vehicle-data-platform/apps/web/src/test/App.test.tsx @@ -52,8 +52,8 @@ test('renders vehicle platform shell', () => { expect(screen.getByRole('button', { name: '客户主线 统计查询' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: '客户主线 数据导出' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: '客户主线 告警通知' })).toBeInTheDocument(); - expect(screen.getByText('实时运营')).toBeInTheDocument(); - expect(screen.getByText('地图看车、在线监控、异常优先')).toBeInTheDocument(); + expect(screen.getByText('车辆监控')).toBeInTheDocument(); + expect(screen.getByText('地图看车、实时状态、异常优先')).toBeInTheDocument(); expect(screen.getAllByText('车辆服务').length).toBeGreaterThanOrEqual(1); expect(screen.getByText('按 VIN、车牌、手机号管理车辆')).toBeInTheDocument(); expect(screen.getAllByText('轨迹统计').length).toBeGreaterThanOrEqual(1); @@ -67,10 +67,29 @@ test('renders vehicle platform shell', () => { expect(screen.getByText('运维证据只在客户问题需要解释时展开,不作为客户默认入口。')).toBeInTheDocument(); expect(screen.getByRole('button', { name: '展开内部证据区' })).toBeInTheDocument(); expect(screen.getByRole('button', { name: '内部证据区 运维质量' })).toBeInTheDocument(); - expect(screen.getAllByText('运营总览').length).toBeGreaterThanOrEqual(1); + expect(screen.getAllByText('车辆总览').length).toBeGreaterThanOrEqual(1); expect(getComputedStyle(document.body).minWidth).not.toBe('1280px'); }); +test('sidebar frames the first navigation group as vehicle monitoring for customers', () => { + vi.spyOn(globalThis, 'fetch').mockImplementation(async () => ({ + ok: true, + json: async () => ({ + data: { items: [], total: 0, limit: 20, offset: 0, linkHealth: [], runtime: { requestTimeoutMs: 5000 } }, + traceId: 'trace-test', + timestamp: 1783094400000 + }) + }) as Response); + + render(); + + expect(screen.getByText('车辆监控')).toBeInTheDocument(); + expect(screen.getByText('地图看车、实时状态、异常优先')).toBeInTheDocument(); + expect(screen.getAllByText('车辆总览').length).toBeGreaterThanOrEqual(1); + expect(screen.queryByText('实时运营')).not.toBeInTheDocument(); + expect(screen.queryByText('运营总览')).not.toBeInTheDocument(); +}); + test('dashboard opens with a customer vehicle service path instead of protocol entry points', async () => { window.history.replaceState(null, '', '/#/dashboard'); vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {