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.

1.0 KB
Raw Blame
import { describe, expect, it } from 'vitest'
import {
  TERMINAL_REMOVAL_IN_PROGRESS_MESSAGE,
  WATCHER_REMOVAL_IN_PROGRESS_MESSAGE,
  isWorktreeRemovalFenceError
} from './removal-fence-error'

describe('isWorktreeRemovalFenceError', () => {
  it('recognizes the raw terminal and watcher fence messages', () => {
    expect(isWorktreeRemovalFenceError(TERMINAL_REMOVAL_IN_PROGRESS_MESSAGE)).toBe(true)
    expect(isWorktreeRemovalFenceError(WATCHER_REMOVAL_IN_PROGRESS_MESSAGE)).toBe(true)
  })

  it('recognizes the message after Electron IPC prefixes the reject', () => {
    const wrapped = `Error invoking remote method 'pty:spawn': Error: ${TERMINAL_REMOVAL_IN_PROGRESS_MESSAGE}`
    expect(isWorktreeRemovalFenceError(wrapped)).toBe(true)
  })

  it('does not match unrelated terminal errors', () => {
    expect(isWorktreeRemovalFenceError('Failed to save terminal session state')).toBe(false)
    expect(isWorktreeRemovalFenceError('shell exited with code 1')).toBe(false)
    expect(isWorktreeRemovalFenceError('')).toBe(false)
  })
})