hermes-agent/apps/desktop/electron/backend-start-failure.test.ts

23 lines
971 B
TypeScript

import assert from 'node:assert/strict'
import { test } from 'vitest'
import { shouldLatchBackendStartFailure } from './backend-start-failure'
test('latches a LOCAL backend failure so the install-retry loop is broken', () => {
assert.equal(shouldLatchBackendStartFailure({ attemptedRemote: false }), true)
})
test('never latches a REMOTE failure so recovery stays retryable without a restart', () => {
// A lapsed OAuth session / mint timeout / host briefly unreachable across a
// laptop sleep must not wedge the app: the next connect has to re-attempt and
// re-mint against the refreshed session.
assert.equal(shouldLatchBackendStartFailure({ attemptedRemote: true }), false)
})
test('the two branches are mutually exclusive (a failure either latches or stays retryable)', () => {
for (const attemptedRemote of [true, false]) {
const latched = shouldLatchBackendStartFailure({ attemptedRemote })
assert.equal(latched, !attemptedRemote)
}
})