mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-08-29 04:26:38 +00:00
test(client): update remote session fixtures
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -19,7 +19,6 @@ describe('Client Cordis inspect catalog', () => {
|
||||
'pickDirectory(): Promise<string | null>',
|
||||
'listDirectory(path?: string, signal?: AbortSignal): Promise<DirectoryListing>',
|
||||
'createDirectory(path: string, name: string): Promise<string>',
|
||||
'openPath(path: string): Promise<void>',
|
||||
])
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user