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.

905 B
Raw Blame
import { describe, expect, it, vi } from 'vitest'
import { opencodeGoCredentialsApi } from './api/opencode-go-credentials-bridge'

const invoke = vi.hoisted(() => vi.fn(async () => ({ apiKeyConfigured: true })))
vi.mock('electron', () => ({ ipcRenderer: { invoke } }))

describe('OpenCode Go credential bridge', () => {
  it('exposes only status and write operations', async () => {
    expect(await opencodeGoCredentialsApi.getStatus()).toEqual({ apiKeyConfigured: true })
    await opencodeGoCredentialsApi.saveApiKey('fake-key')
    await opencodeGoCredentialsApi.clearApiKey()
    expect(invoke.mock.calls).toEqual([
      ['opencodeGoCredentials:getStatus'],
      ['opencodeGoCredentials:saveApiKey', 'fake-key'],
      ['opencodeGoCredentials:clearApiKey']
    ])
    expect(Object.keys(opencodeGoCredentialsApi)).toEqual([
      'getStatus',
      'saveApiKey',
      'clearApiKey'
    ])
  })
})