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.
TypeScript adeagent-ideai-agentsautomationbotclaude-codecodexghosttygrok-bothermes-agentmobile-appmuseopenclawopencodeorchestrationpiruntimeterminalworktreesyc-backed
import { describe, expect, it, vi } from 'vitest'
import { connectionRetryAction } from './connection-retry-action'
describe('connectionRetryAction', () => {
it('re-reads when the host is connected, with or without a re-dial', () => {
for (const forceReconnect of [null, vi.fn()]) {
const reload = vi.fn()
connectionRetryAction({ hostId: 'h', needsReconnect: false, forceReconnect, reload })?.()
expect(reload).toHaveBeenCalledTimes(1)
if (forceReconnect) {
expect(forceReconnect).not.toHaveBeenCalled()
}
}
})
it('re-dials a host that needs it where this document can dial', () => {
const forceReconnect = vi.fn()
const reload = vi.fn()
connectionRetryAction({ hostId: 'h', needsReconnect: true, forceReconnect, reload })?.()
expect({ redials: forceReconnect.mock.calls, reloads: reload.mock.calls.length }).toEqual({
redials: [['h']],
reloads: 0
})
})
it('offers nothing where a re-dial is needed and this document cannot make one', () => {
expect(
connectionRetryAction({
hostId: 'h',
needsReconnect: true,
forceReconnect: null,
reload: () => {}
})
).toBeNull()
})
it('re-reads when there is no host to re-dial', () => {
for (const forceReconnect of [null, vi.fn()]) {
const reload = vi.fn()
connectionRetryAction({ hostId: undefined, needsReconnect: true, forceReconnect, reload })?.()
expect(reload).toHaveBeenCalledTimes(1)
if (forceReconnect) {
expect(forceReconnect).not.toHaveBeenCalled()
}
}
})
})