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

@@ -0,0 +1,31 @@
import { cleanup, fireEvent, render, screen } from '@testing-library/react';
import { afterEach, describe, expect, test, vi } from 'vitest';
import { MapRetryAction, RecoveryActions } from './RecoveryActions';
describe('RecoveryActions', () => {
afterEach(cleanup);
test('renders a compact Semi retry action for map errors', () => {
const onRetry = vi.fn();
render(<MapRetryAction onRetry={onRetry} />);
const action = screen.getByRole('button', { name: '重新加载地图' });
expect(action).toHaveClass('semi-button', 'v2-map-retry-action');
fireEvent.click(action);
expect(onRetry).toHaveBeenCalledOnce();
});
test('renders primary and secondary recovery hierarchy with Semi buttons', () => {
const onPrimary = vi.fn();
const onSecondary = vi.fn();
render(<RecoveryActions primaryLabel="重试加载模块" onPrimary={onPrimary} secondaryLabel="刷新当前页面" onSecondary={onSecondary} showHome={false} />);
const primary = screen.getByRole('button', { name: '重试加载模块' });
const secondary = screen.getByRole('button', { name: '刷新当前页面' });
expect(primary).toHaveClass('semi-button-primary');
expect(secondary).toHaveClass('semi-button-light');
fireEvent.click(primary);
fireEvent.click(secondary);
expect(onPrimary).toHaveBeenCalledOnce();
expect(onSecondary).toHaveBeenCalledOnce();
});
});