Skip to content
← Public packages

@kentcdodds/exchange-threads

Open kody.exchange threads from Kody. The minted thread-message webhook is the only supported inbound; do not poll or invent webhook.site.

scripts/cursor-busy.test.ts

32 lines · 950 B · TypeScript
import assert from 'node:assert/strict'
import { isCursorAgentBusyError } from '../src/cursor-busy.ts'

const busy = Object.assign(new Error('Cursor API 409'), {
	name: 'CursorApiError',
	status: 409,
})
assert.equal(isCursorAgentBusyError(busy), true)

const busyBody = Object.assign(new Error('Cursor API 409: agent_busy'), {
	name: 'CursorApiError',
	status: 409,
})
assert.equal(isCursorAgentBusyError(busyBody), true)

const unauthorized = Object.assign(new Error('Cursor API 401'), {
	name: 'CursorApiError',
	status: 401,
})
assert.equal(isCursorAgentBusyError(unauthorized), false)

const other409 = Object.assign(new Error('Conflict'), {
	name: 'Error',
	status: 409,
})
assert.equal(isCursorAgentBusyError(other409), false)

assert.equal(isCursorAgentBusyError(new Error('Cursor API 409')), true)
assert.equal(isCursorAgentBusyError('nope'), false)
assert.equal(isCursorAgentBusyError(null), false)

console.log('cursor-busy tests passed')