diff --git a/packages/client/ui-subagent/package.json b/packages/client/ui-subagent/package.json index a3e753d91b..6dc3f9bd7d 100644 --- a/packages/client/ui-subagent/package.json +++ b/packages/client/ui-subagent/package.json @@ -53,6 +53,7 @@ "devDependencies": { "@deepseek-ai/dsh-client-locale": "workspace:^", "@deepseek-ai/dsh-client-runtime": "workspace:^", + "@deepseek-ai/dsh-client-test-runtime": "workspace:^", "@deepseek-ai/dsh-client-ui-conversation": "workspace:^", "@deepseek-ai/dsh-client-ui-primitives": "workspace:^", "@deepseek-ai/dsh-client-ui-slash": "workspace:^", diff --git a/packages/client/ui-subagent/tests/conversation-ui.spec.tsx b/packages/client/ui-subagent/tests/conversation-ui.spec.tsx index 5649b2b257..ded344145f 100644 --- a/packages/client/ui-subagent/tests/conversation-ui.spec.tsx +++ b/packages/client/ui-subagent/tests/conversation-ui.spec.tsx @@ -1,16 +1,15 @@ // @vitest-environment jsdom import { afterEach, describe, expect, it, vi } from 'vitest' import { cleanup, fireEvent, render, screen } from '@testing-library/react' +import { makeTranslate } from '@deepseek-ai/dsh-client-test-runtime' import type { SessionId, SessionListState, SessionSummary, SubagentCatalogSnapshot, } from '@deepseek-ai/dsh-client-runtime/client' import { SubagentCatalogAction, type SubagentCatalogActionProps, } from '../src/client/SubagentCatalogAction.tsx' -import { - SubagentReadOnlyComposer, type SubagentReadOnlyComposerProps, -} from '../src/client/SubagentReadOnlyComposer.tsx' -import { zh, type SubagentKey } from '../src/client/locales.ts' +import { SubagentReadOnlyComposer } from '../src/client/SubagentReadOnlyComposer.tsx' +import { zh } from '../src/client/locales.ts' afterEach(() => { cleanup() @@ -20,6 +19,7 @@ afterEach(() => { const PARENT = 'parent' as SessionId const CHILD = 'child' as SessionId const GRANDCHILD = 'grandchild' as SessionId +const t: SubagentCatalogActionProps['t'] = makeTranslate(zh) function catalog(over: Partial = {}): SubagentCatalogSnapshot { return { @@ -66,15 +66,6 @@ function props( function useSessions(select: (snapshot: SessionListState) => T): T { return select(state) } - // The zh dictionary is the source of truth for this spec's assertions: - // the stub interpolates `{name}` params like the locale service does. - const t = ((key: SubagentKey, params?: Record): string => { - let text: string = zh[key] - for (const [name, value] of Object.entries(params ?? {})) { - text = text.replaceAll(`{${name}}`, String(value)) - } - return text - }) as SubagentCatalogActionProps['t'] return { sessionId: PARENT, useSessions, @@ -484,9 +475,6 @@ describe('SubagentCatalogAction', () => { }) describe('SubagentReadOnlyComposer', () => { - // The zh dictionary is the source of truth for this spec's assertions. - const t = ((key: SubagentKey): string => zh[key]) as SubagentReadOnlyComposerProps['t'] - it('explains the exact missing-parent recovery path', () => { render() expect(screen.getByRole('status').textContent).toContain('父会话当前不在线') diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d81b237b7c..c7053f6738 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1885,6 +1885,9 @@ importers: '@deepseek-ai/dsh-client-runtime': specifier: workspace:^ version: link:../runtime + '@deepseek-ai/dsh-client-test-runtime': + specifier: workspace:^ + version: link:../test-runtime '@deepseek-ai/dsh-client-ui-conversation': specifier: workspace:^ version: link:../ui-conversation