From 5f6293e67a4cc52085db948b163a8aa4d00e832b Mon Sep 17 00:00:00 2001 From: imccyu <276526105+imccyu@users.noreply.github.com> Date: Thu, 27 Aug 2026 19:48:58 +0800 Subject: [PATCH] test(client): update remote session fixtures --- .../tests/assembly-surfaces.client.spec.tsx | 10 +++++--- .../tests/chat-code-subcalls.client.spec.tsx | 11 ++++---- .../tests/toolview-slot.client.spec.tsx | 25 +++++++++---------- .../tests/api-catalog.client.spec.ts | 1 - 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/packages/client/ui-tool/tests/assembly-surfaces.client.spec.tsx b/packages/client/ui-tool/tests/assembly-surfaces.client.spec.tsx index f6e0ef3098..63cea1a148 100644 --- a/packages/client/ui-tool/tests/assembly-surfaces.client.spec.tsx +++ b/packages/client/ui-tool/tests/assembly-surfaces.client.spec.tsx @@ -10,7 +10,7 @@ import { apply as applyChat, inject as injectChat, type ToolResultNode, } from '@deepseek-ai/dsh-client-ui-chat/client' import type { PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots' -import { SlotTestRuntime, usePinnedBrowserLanguages, stubSettingsScope } from '@deepseek-ai/dsh-client-test-runtime' +import { SlotTestRuntime, TestRemote, usePinnedBrowserLanguages, stubSettingsScope } from '@deepseek-ai/dsh-client-test-runtime' import { apply as applyConversation, inject as injectConversation } from '@deepseek-ai/dsh-client-ui-conversation/client' import { apply as applyTool, inject as injectTool } from '../src/client/apply.ts' import { toolSessionEvents } from './tool-details-render.client.tsx' @@ -76,13 +76,15 @@ async function bench(nodes: ToolResultNode[]) { isLoopback: false, hostDescription: { getSnapshot: () => undefined, subscribe: () => () => {} }, }) - // ui-theme's Appearance row binds a durable scope through these two. - runtime.ctx.provide('remote', { $on: () => () => {} }) + new TestRemote(runtime.ctx, { + session: { + openWorkspacePath: vi.fn(async () => ({ ok: true, value: { opened: true } })), + }, + }) runtime.ctx.provide('settingsScope', { bind: () => stubSettingsScope().scope } as never) runtime.ctx.provide('layout', { openDetails: vi.fn(), closeDetails: vi.fn() }) runtime.ctx.provide('uiWorkspace', { connectWorkspace: vi.fn(async () => SID), - openPath: vi.fn(async () => {}), } as never) const locale = new LocaleRuntime(runtime.ctx) runtime.ctx.provide('locale', locale) diff --git a/packages/client/ui-tool/tests/chat-code-subcalls.client.spec.tsx b/packages/client/ui-tool/tests/chat-code-subcalls.client.spec.tsx index d2f8ccec8c..be9061fbc2 100644 --- a/packages/client/ui-tool/tests/chat-code-subcalls.client.spec.tsx +++ b/packages/client/ui-tool/tests/chat-code-subcalls.client.spec.tsx @@ -7,7 +7,7 @@ import type { ChatSnapshot, RunningToolCall, ToolCallBlock, ToolResultNode, } from '@deepseek-ai/dsh-client-ui-chat/client' import type { SessionId } from '@deepseek-ai/dsh-session/types' -import { SlotTestRuntime, stubSettingsScope } from '@deepseek-ai/dsh-client-test-runtime' +import { SlotTestRuntime, TestRemote, stubSettingsScope } from '@deepseek-ai/dsh-client-test-runtime' import { LocaleRuntime } from '@deepseek-ai/dsh-client-locale/client' import type { PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots' import { @@ -116,9 +116,10 @@ async function bench(snapshot: ChatSnapshot) { snapshot: { running: snapshot.legacy.runningCalls.length > 0 }, }) const layout = { openDetails: vi.fn(), closeDetails: vi.fn() } - const openPath = vi.fn(async () => {}) + const openWorkspacePath = vi.fn(async () => ({ ok: true, value: { opened: true } })) ctx.provide('layout', layout as never) - ctx.provide('uiWorkspace', { openPath } as never) + ctx.provide('uiWorkspace', {} as never) + new TestRemote(ctx, { session: { openWorkspacePath } }) ctx.provide('connection', { api: { settings: {} }, isLoopback: false, @@ -132,7 +133,7 @@ async function bench(snapshot: ChatSnapshot) { await runtime.root.declare(ROOT_CHILDREN, AppRoot) await runtime.mount({ inject: [...injectChat], apply: applyChat }) await runtime.mount({ inject: [...injectTool], apply: applyTool }) - return { runtime, layout, openPath } + return { runtime, layout, openWorkspacePath } } function mountApp(runtime: SlotTestRuntime) { @@ -222,7 +223,7 @@ describe('run_code sub-calls through the real chat machinery', () => { view.getByText('notes/demo.txt').click() expect(b.layout.openDetails).not.toHaveBeenCalled() await vi.waitFor(() => { - expect(b.openPath).toHaveBeenCalledWith('notes/demo.txt') + expect(b.openWorkspacePath).toHaveBeenCalledWith({ sessionId: SID, path: 'notes/demo.txt' }) }) view.getByText('List notes').click() expect(b.layout.openDetails).not.toHaveBeenCalled() diff --git a/packages/client/ui-tool/tests/toolview-slot.client.spec.tsx b/packages/client/ui-tool/tests/toolview-slot.client.spec.tsx index 54a165cf40..ad5eb90a10 100644 --- a/packages/client/ui-tool/tests/toolview-slot.client.spec.tsx +++ b/packages/client/ui-tool/tests/toolview-slot.client.spec.tsx @@ -8,7 +8,7 @@ import { apply as applyChat, inject as injectChat, type ToolResultNode, } from '@deepseek-ai/dsh-client-ui-chat/client' import type { PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots' -import { SlotTestRuntime, stubSettingsScope } from '@deepseek-ai/dsh-client-test-runtime' +import { SlotTestRuntime, TestRemote, stubSettingsScope } from '@deepseek-ai/dsh-client-test-runtime' import { LocaleRuntime } from '@deepseek-ai/dsh-client-locale/client' import { apply as applyConversation, inject as injectConversation } from '@deepseek-ai/dsh-client-ui-conversation/client' import { apply as applyTool, inject as injectTool } from '@deepseek-ai/dsh-client-ui-tool/client' @@ -64,16 +64,13 @@ async function bench(nodes: ToolResultNode[]) { isLoopback: false, hostDescription: { getSnapshot: () => undefined, subscribe: () => () => {} }, }) - // ui-theme's Appearance row binds a durable scope through these two. - runtime.ctx.provide('remote', { $on: () => () => {} }) + const openWorkspacePath = vi.fn(async () => ({ ok: true, value: { opened: true } })) + new TestRemote(runtime.ctx, { session: { openWorkspacePath } }) runtime.ctx.provide('settingsScope', { bind: () => stubSettingsScope().scope } as never) const layout = { openDetails: vi.fn(), closeDetails: vi.fn() } runtime.ctx.provide('layout', layout) runtime.ctx.provide('uiWorkspace', { connectWorkspace: vi.fn(async () => SID), - openPath: async (path: string) => { - runtime.workspaces.calls.push({ method: 'openPath', args: [path] }) - }, } as never) const locale = new LocaleRuntime(runtime.ctx) runtime.ctx.provide('locale', locale) @@ -91,7 +88,7 @@ async function bench(nodes: ToolResultNode[]) { await runtime.mount({ inject: [...injectConversation], apply: applyConversation }) await runtime.mount({ inject: [...injectChat], apply: applyChat }) await runtime.mount({ inject: [...injectTool], apply: applyTool }) - return { runtime, slots: runtime.slots, layout } + return { runtime, slots: runtime.slots, layout, openWorkspacePath } } describe('keyed toolview hole through the real machinery', () => { @@ -134,13 +131,13 @@ describe('keyed toolview hole through the real machinery', () => { await b.runtime.dispose() }) - it('file-path clicks travel owner openFile → chat inject → workspaces.openPath', async () => { + it('file-path clicks travel owner openFile → chat inject → session.openWorkspacePath', async () => { const b = await bench([toolResult(3, 'c1', 'read', '{"path":"src/a.ts"}')]) const view = b.runtime.renderRoot() view.getByText('src/a.ts').click() expect(b.layout.openDetails).not.toHaveBeenCalled() await vi.waitFor(() => { - expect(b.runtime.workspaces.calls).toContainEqual({ method: 'openPath', args: ['src/a.ts'] }) + expect(b.openWorkspacePath).toHaveBeenCalledWith({ sessionId: SID, path: 'src/a.ts' }) }) await b.runtime.dispose() }) @@ -150,7 +147,7 @@ describe('keyed toolview hole through the real machinery', () => { const view = b.runtime.renderRoot() view.getByText('Build').click() expect(b.layout.openDetails).not.toHaveBeenCalled() - expect(b.runtime.workspaces.calls.some(c => c.method === 'openPath')).toBe(false) + expect(b.openWorkspacePath).not.toHaveBeenCalled() await b.runtime.dispose() }) @@ -214,13 +211,15 @@ describe('registrant declaration injection', () => { isLoopback: false, hostDescription: { getSnapshot: () => undefined, subscribe: () => () => {} }, }) - // ui-theme's Appearance row binds a durable scope through these two. - runtime.ctx.provide('remote', { $on: () => () => {} }) + new TestRemote(runtime.ctx, { + session: { + openWorkspacePath: vi.fn(async () => ({ ok: true, value: { opened: true } })), + }, + }) runtime.ctx.provide('settingsScope', { bind: () => stubSettingsScope().scope } as never) runtime.ctx.provide('layout', { openDetails: vi.fn(), closeDetails: vi.fn() }) runtime.ctx.provide('uiWorkspace', { connectWorkspace: vi.fn(async () => SID), - openPath: vi.fn(async () => {}), } as never) const locale = new LocaleRuntime(runtime.ctx) runtime.ctx.provide('locale', locale) diff --git a/packages/extensions/cordis-client-runner/tests/api-catalog.client.spec.ts b/packages/extensions/cordis-client-runner/tests/api-catalog.client.spec.ts index 019d34ac90..3dbfa80b05 100644 --- a/packages/extensions/cordis-client-runner/tests/api-catalog.client.spec.ts +++ b/packages/extensions/cordis-client-runner/tests/api-catalog.client.spec.ts @@ -19,7 +19,6 @@ describe('Client Cordis inspect catalog', () => { 'pickDirectory(): Promise', 'listDirectory(path?: string, signal?: AbortSignal): Promise', 'createDirectory(path: string, name: string): Promise', - 'openPath(path: string): Promise', ]) })