diff --git a/src/web/App.login-surface.test.tsx b/src/web/App.login-surface.test.tsx index 00c21b1..f0e2c3e 100644 --- a/src/web/App.login-surface.test.tsx +++ b/src/web/App.login-surface.test.tsx @@ -72,7 +72,7 @@ describe('Login surface', () => { expect(githubLink.props.target).toBe('_blank'); expect(tokenInput.props.type).toBe('password'); } finally { - root.unmount(); + root?.unmount(); } }); }); diff --git a/src/web/components/charts/SiteDistributionChart.tsx b/src/web/components/charts/SiteDistributionChart.tsx index a652dad..02025fb 100644 --- a/src/web/components/charts/SiteDistributionChart.tsx +++ b/src/web/components/charts/SiteDistributionChart.tsx @@ -139,7 +139,7 @@ export default function SiteDistributionChart({ data, loading }: SiteDistributio value: (datum: unknown) => { const item = coerceDatumRecord(datum); const pct = safeNumber(item._percent_); - return `${safeNumber(pct).toFixed(1)}%`; + return `${pct.toFixed(1)}%`; }, }, { diff --git a/src/web/pages/DownstreamKeys.test.tsx b/src/web/pages/DownstreamKeys.test.tsx index 73bfb36..546c0a1 100644 --- a/src/web/pages/DownstreamKeys.test.tsx +++ b/src/web/pages/DownstreamKeys.test.tsx @@ -193,7 +193,7 @@ describe('DownstreamKeys page', () => { expect(text).toContain('主分组'); expect(text).toContain('移动端'); } finally { - root.unmount(); + root?.unmount(); } }); @@ -447,7 +447,7 @@ describe('DownstreamKeys page', () => { expect(collectText(root!.root)).not.toContain('固定窗口对比'); expect(collectText(root!.root)).not.toContain('trend:2'); } finally { - root.unmount(); + root?.unmount(); } }); diff --git a/src/web/pages/accounts.create-intent.test.tsx b/src/web/pages/accounts.create-intent.test.tsx index 6199e3f..80870d5 100644 --- a/src/web/pages/accounts.create-intent.test.tsx +++ b/src/web/pages/accounts.create-intent.test.tsx @@ -64,7 +64,7 @@ describe('Accounts create intent handling', () => { const selects = root.root.findAllByType(ModernSelect); expect(selects[1]?.props.value).toBe('10'); } finally { - root.unmount(); + root?.unmount(); } }); @@ -77,7 +77,7 @@ describe('Accounts create intent handling', () => { const selects = root.root.findAllByType(ModernSelect); expect(selects[1]?.props.value).toBe('10'); } finally { - root.unmount(); + root?.unmount(); } }); @@ -88,7 +88,7 @@ describe('Accounts create intent handling', () => { expect(rendered).not.toContain('添加 Session 连接'); expect(rendered).not.toContain('添加 API Key 连接'); } finally { - root.unmount(); + root?.unmount(); } }); }); diff --git a/src/web/pages/sites.disabled-models-save.test.tsx b/src/web/pages/sites.disabled-models-save.test.tsx index 3d69495..40005cb 100644 --- a/src/web/pages/sites.disabled-models-save.test.tsx +++ b/src/web/pages/sites.disabled-models-save.test.tsx @@ -146,7 +146,7 @@ describe('Sites disabled models save', () => { expect(apiMock.updateSiteDisabledModels).toHaveBeenCalledWith(1, ['gpt-4o']); } finally { - root.unmount(); + root?.unmount(); } }); @@ -190,7 +190,7 @@ describe('Sites disabled models save', () => { expect(apiMock.updateSiteDisabledModels).toHaveBeenCalledWith(1, ['gpt-4o']); } finally { - root.unmount(); + root?.unmount(); } }); });