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.

970 B
Raw Blame
import { describe, expect, it } from 'vitest'
import { pickPreferredGitRemote } from './preferred-git-remote'

describe('pickPreferredGitRemote', () => {
  it('prefers origin even when another remote is listed first', () => {
    expect(pickPreferredGitRemote(['fork', 'origin'])).toBe('origin')
  })

  it('returns the sole remote when there is exactly one', () => {
    expect(pickPreferredGitRemote(['upstream'])).toBe('upstream')
  })

  it('ignores blank lines from `git remote` output', () => {
    expect(pickPreferredGitRemote(['fork\n', ' origin ', ''])).toBe('origin')
  })

  it('throws when there are no remotes', () => {
    expect(() => pickPreferredGitRemote([''])).toThrow('Repo has no configured git remotes.')
  })

  it('refuses to guess between multiple non-origin remotes', () => {
    expect(() => pickPreferredGitRemote(['fork', 'upstream'])).toThrow(
      'Repo has multiple remotes (fork, upstream) and no default is configured.'
    )
  })
})