feat(platform): harden telemetry pipeline and unify Semi UI workspaces

This commit is contained in:
lingniu
2026-07-18 00:26:36 +08:00
parent 65b4e4f055
commit 159c80b0ae
136 changed files with 21616 additions and 1785 deletions

View File

@@ -344,7 +344,9 @@ test('recovers in place after a transient AMap failure and renders data that arr
);
expect(await screen.findByText(/地图加载失败/)).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: /重新加载地图/ }));
const retry = screen.getByRole('button', { name: /重新加载地图/ });
expect(retry).toHaveClass('semi-button', 'v2-map-retry-action');
fireEvent.click(retry);
expect(setData).not.toHaveBeenCalled();
await act(async () => {
@@ -520,6 +522,23 @@ test('converts AMap GCJ-02 bounds back to WGS-84 before requesting monitor data'
expect(Math.abs(bounds[3] - 24)).toBeLessThan(0.0005);
});
test('drops a wrapped world viewport instead of emitting invalid WGS-84 bounds', async () => {
getZoom.mockReturnValue(3);
getBounds.mockReturnValue({
getSouthWest: () => ({ getLng: () => -80, getLat: () => -20 }),
getNorthEast: () => ({ getLng: () => 260, getLat: () => 70 })
});
window.__LINGNIU_APP_CONFIG__ = { amapWebJsKey: 'amap-web-key' };
window.AMapLoader = { load: vi.fn(async () => amapMock()) };
const onViewportChange = vi.fn();
render(<FleetMap vehicles={[]} monitorMap={pointMap} onSelect={() => undefined} onViewportChange={onViewportChange} />);
await waitFor(() => expect(onViewportChange).toHaveBeenCalled());
const viewport = onViewportChange.mock.calls[onViewportChange.mock.calls.length - 1]?.[0] as { zoom: number; bounds: string };
expect(viewport).toEqual({ zoom: 3, bounds: '' });
});
test('renders one selected plate and smoothly follows it until the map is dragged', async () => {
useFastAnimationFrames();
window.__LINGNIU_APP_CONFIG__ = { amapWebJsKey: 'amap-web-key' };
@@ -702,7 +721,8 @@ test('renders crisp province totals and drills into the existing cluster layer',
expect(setData).toHaveBeenLastCalledWith([]);
const provinceIndex = markerOptions.findIndex((options) => String(options.content).includes('广东省'));
expect(String(markerOptions[provinceIndex]?.content)).toContain('<strong>3</strong>');
expect(String(markerOptions[provinceIndex]?.content)).toContain('在线 2');
expect(String(markerOptions[provinceIndex]?.content)).toContain('<span>广东</span>');
expect(String(markerOptions[provinceIndex]?.content)).not.toContain('在线');
markerInstances[provinceIndex]?.handlers.get('click')?.();
expect(setZoomAndCenter).toHaveBeenLastCalledWith(7, [113.266, 23.132]);