hermes-agent/apps/desktop/src/lib/gateway-rpc.test.ts
xxxigm 217b3c283a test(desktop): cover projects RPC capability probing
Regression tests for stale-backend detection when projects.create is
missing from an older backend that still reports the same semver.
2026-06-30 21:23:38 +07:00

16 lines
650 B
TypeScript

import { describe, expect, it } from 'vitest'
import { isMissingRpcMethod } from './gateway-rpc'
describe('isMissingRpcMethod', () => {
it('detects JSON-RPC method-not-found errors', () => {
expect(isMissingRpcMethod(new Error('unknown method: projects.create'))).toBe(true)
expect(isMissingRpcMethod(new Error('Method not found'))).toBe(true)
expect(isMissingRpcMethod(new Error('RPC failed: -32601'))).toBe(true)
})
it('ignores unrelated failures', () => {
expect(isMissingRpcMethod(new Error('Hermes gateway is not connected'))).toBe(false)
expect(isMissingRpcMethod(new Error('no such project'))).toBe(false)
})
})