mirror of
https://github.com/stablyai/orca.git
synced 2026-11-04 19:17:28 +00:00
* test: strengthen hook identity and transport assertions * test: strengthen mobile handoff and release policy coverage --------- Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
51 lines
1.6 KiB
TypeScript
51 lines
1.6 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { buildAgentNotificationId } from './agent-notification-id'
|
|
|
|
describe('buildAgentNotificationId', () => {
|
|
it('builds a stable escaped id for the same agent event metadata', () => {
|
|
const args = {
|
|
worktreeId: 'repo::/Users/me/orca/workspaces/feature',
|
|
paneKey: 'tab-1:11111111-1111-4111-8111-111111111111',
|
|
stateStartedAt: 1780000000123
|
|
}
|
|
|
|
const id = buildAgentNotificationId(args)
|
|
expect(id).toBe(
|
|
'agent:repo%3A%3A%2FUsers%2Fme%2Forca%2Fworkspaces%2Ffeature:tab-1%3A11111111-1111-4111-8111-111111111111:1780000000123'
|
|
)
|
|
expect(buildAgentNotificationId(args)).toBe(id)
|
|
})
|
|
|
|
it('changes when the agent state start time changes', () => {
|
|
const base = {
|
|
worktreeId: 'repo::/Users/me/orca/workspaces/feature',
|
|
paneKey: 'tab-1:11111111-1111-4111-8111-111111111111'
|
|
}
|
|
|
|
expect(buildAgentNotificationId({ ...base, stateStartedAt: 1780000000123 })).not.toBe(
|
|
buildAgentNotificationId({ ...base, stateStartedAt: 1780000000456 })
|
|
)
|
|
})
|
|
|
|
it('returns null when required fields are missing', () => {
|
|
expect(
|
|
buildAgentNotificationId({
|
|
paneKey: 'tab-1:11111111-1111-4111-8111-111111111111',
|
|
stateStartedAt: 1780000000123
|
|
})
|
|
).toBeNull()
|
|
expect(
|
|
buildAgentNotificationId({
|
|
worktreeId: 'repo::/Users/me/orca/workspaces/feature',
|
|
stateStartedAt: 1780000000123
|
|
})
|
|
).toBeNull()
|
|
expect(
|
|
buildAgentNotificationId({
|
|
worktreeId: 'repo::/Users/me/orca/workspaces/feature',
|
|
paneKey: 'tab-1:11111111-1111-4111-8111-111111111111'
|
|
})
|
|
).toBeNull()
|
|
})
|
|
})
|