Files
orca/src/main/runtime/remote-viewer-launch-env.test.ts
T
Neil 7f21cc91b8 fix(codex): Codex copy from a remote pane reaches the viewer clipboard (#31453)
* fix(codex): copy from a paired client's or WSL Codex reaches the viewer's clipboard

* test: type the Claude launch fixture
2026-10-21 00:58:03 -07:00

42 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { afterEach, describe, expect, it, vi } from 'vitest'
import { CODEX_REMOTE_VIEWER_SSH_CONNECTION } from '../ipc/pty/host-env/codex-terminal-clipboard'
import { applyRemoteViewerLaunchEnv } from './remote-viewer-launch-env'
afterEach(() => vi.unstubAllEnvs())
describe('applyRemoteViewerLaunchEnv', () => {
it.each([true, false])('marks a remote caller’s Codex (image support %s)', (supported) => {
vi.stubEnv('SSH_CONNECTION', undefined)
vi.stubEnv('SSH_TTY', undefined)
const launch = { launchAgent: 'codex' as const, env: { KEEP: '1' } }
expect(applyRemoteViewerLaunchEnv(launch, supported).env).toEqual({
KEEP: '1',
SSH_CONNECTION: CODEX_REMOTE_VIEWER_SSH_CONNECTION
})
expect(launch.env).toEqual({ KEEP: '1' })
})
it('leaves a launch from this host untouched', () => {
const launch = { launchAgent: 'codex' as const }
expect(applyRemoteViewerLaunchEnv(launch, undefined)).toBe(launch)
})
it('keeps an SSH session the launch already carries', () => {
const launch = {
launchAgent: 'codex' as const,
env: { SSH_CONNECTION: '10.0.0.1 1 10.0.0.2 22' }
}
expect(applyRemoteViewerLaunchEnv(launch, true)).toBe(launch)
})
it('still applies the Claude image rule and never marks Claude', () => {
vi.stubEnv('CLAUDE_CODE_FORCE_TERMINAL_IMAGES', undefined)
const launch: { launchAgent: 'claude'; env?: Record<string, string> } = {
launchAgent: 'claude'
}
expect(applyRemoteViewerLaunchEnv(launch, false).env).toEqual({
CLAUDE_CODE_FORCE_TERMINAL_IMAGES: '0'
})
})
})