mirror of
https://github.com/stablyai/orca.git
synced 2026-10-20 16:03:20 +00:00
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -505,4 +505,27 @@ describe('RuntimeBrowserCommands headless offscreen routing', () => {
|
||||
})
|
||||
expect(closeTab).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('forwards an unresolved worktree to the bridge unchanged for keyboard inserttext', async () => {
|
||||
const { RuntimeBrowserCommands } = await import('./orca-runtime-browser')
|
||||
// Why: when no --worktree is passed (or cwd is outside a managed worktree),
|
||||
// worktreeId arrives undefined. The bridge — not the runtime — owns the
|
||||
// cross-worktree guard, so verify the undefined scope is threaded through
|
||||
// intact rather than silently widened here.
|
||||
const keyboardInsertText = vi.fn().mockResolvedValue({ inserted: true })
|
||||
const bridge = {
|
||||
getRegisteredTabs: vi.fn(() => new Map([['page-1', 100]])),
|
||||
keyboardInsertText
|
||||
} as unknown as AgentBrowserBridge
|
||||
const commands = new RuntimeBrowserCommands(
|
||||
createHost({
|
||||
getAgentBrowserBridge: () => bridge,
|
||||
getAuthoritativeWindow: vi.fn(() => ({ webContents: { send: vi.fn() } }) as never)
|
||||
})
|
||||
)
|
||||
|
||||
await commands.browserKeyboardInsertText({ text: 'hello' })
|
||||
|
||||
expect(keyboardInsertText).toHaveBeenCalledWith('hello', undefined, undefined)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user