refactor(ui): converge semi operations workspace

This commit is contained in:
lingniu
2026-07-19 18:56:35 +08:00
parent 0f51e3d375
commit 2c93999417
5 changed files with 198 additions and 17 deletions

View File

@@ -253,6 +253,27 @@ test('reconciles service identities with bound and identity-required vehicles',
expect(screen.queryByText('统一车辆视角')).not.toBeInTheDocument();
});
test('normalizes nullable health evidence arrays without crashing the workspace', async () => {
seedSession();
mocks.opsHealth.mockResolvedValue({
linkHealth: null, kafkaLag: 0, activeConnections: 10, capacityFindings: null, redisOnlineKeys: 5,
tdengineWritable: true, mysqlWritable: true,
runtime: { platformRelease: 'test-release', dataMode: 'production', requestTimeoutMs: 5000, amapSecurityProxyEnabled: true, amapSecurityCodeExposed: false }
});
mocks.sourceReadiness.mockResolvedValue({
totalVehicles: 1024, boundVehicles: 1024, identityRequiredVehicles: 0, onlineVehicles: 234,
kafkaLag: 0, activeConnections: 10, redisOnlineKeys: 5, platformRelease: 'test-release', sources: null
});
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
renderOperations(client, ['/operations?view=health']);
expect(await screen.findByRole('heading', { name: '运行概览', level: 5 })).toBeInTheDocument();
expect(await screen.findAllByText('暂无协议来源')).toHaveLength(2);
expect(screen.getByText('暂无链路探针')).toBeInTheDocument();
expect(screen.getByText('容量检查通过')).toBeInTheDocument();
expect(screen.queryByText('当前模块暂时无法显示')).not.toBeInTheDocument();
});
test('includes protocol readiness in the global health verdict and prioritizes its evidence', async () => {
seedSession();
mocks.opsHealth.mockResolvedValue({