Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

1005 B
Raw Blame
import { describe, expect, it } from 'vitest'
import { isTerminalLeafMoveRequest } from './terminal-leaf-move'

const LEAF = '22222222-2222-4222-8222-222222222222'
const valid = {
  worktreeId: 'repo-1::/tmp/wt',
  sourceTabId: 'tab-source',
  targetTabId: 'tab-target',
  leafId: LEAF,
  ptyId: null
}

describe('isTerminalLeafMoveRequest', () => {
  it('accepts a move between two tabs with a stable leaf id', () => {
    expect(isTerminalLeafMoveRequest(valid)).toBe(true)
    expect(isTerminalLeafMoveRequest({ ...valid, ptyId: 'pty-1' })).toBe(true)
  })

  it.each([
    ['the same tab', { targetTabId: 'tab-source' }],
    ['a legacy numeric leaf id', { leafId: '2' }],
    ['a source tab id that would split a pane key', { sourceTabId: 'tab:source' }],
    ['a target tab id that would split a pane key', { targetTabId: 'tab:target' }],
    ['an empty PTY id', { ptyId: '' }]
  ])('rejects %s', (_name, patch) => {
    expect(isTerminalLeafMoveRequest({ ...valid, ...patch })).toBe(false)
  })
})