feat(platform): add online status handoff

This commit is contained in:
lingniu
2026-07-04 20:44:07 +08:00
parent 4b34a2bf4c
commit e8f0ebff35
2 changed files with 62 additions and 0 deletions

View File

@@ -7023,6 +7023,11 @@ test('shows mileage statistics workspace with trend source and definition', asyn
test('shows vehicle-first statistics domains for one vehicle service', async () => {
window.history.replaceState(null, '', '/#/mileage?keyword=VIN-STATS-SERVICE&protocol=JT808');
const writeText = vi.fn(() => Promise.resolve());
Object.defineProperty(navigator, 'clipboard', {
configurable: true,
value: { writeText }
});
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
const path = String(input);
if (path.includes('/api/mileage/summary')) {
@@ -7145,6 +7150,13 @@ test('shows vehicle-first statistics domains for one vehicle service', async ()
expect(await screen.findByText('VIN-STATS-SERVICE-OFFLINE')).toBeInTheDocument();
expect(screen.getByText('粤A离线1')).toBeInTheDocument();
expect(screen.getByText('2 小时')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '复制在线状态清单' }));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【车辆在线状态交接】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆范围VIN-STATS-SERVICE'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('在线概览3 在线 / 1 离线 / 在线率 75%'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('协议在线JT808 2/3GB32960 1/2'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('1. 粤A离线1 / VIN-STATS-SERVICE-OFFLINE / 广安车联'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('离线时长2 小时最后上报2026-07-03 18:12:10'));
});
test('copies mileage statistics summary for operations reporting', async () => {