mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
fix(desktop): validate gateway WebSocket URLs
This commit is contained in:
parent
9160f10fc9
commit
02fa447f8e
2 changed files with 24 additions and 2 deletions
|
|
@ -43,6 +43,12 @@ describe('JsonRpcGatewayClient connect() URL guard', () => {
|
|||
)
|
||||
})
|
||||
|
||||
it('rejects a malformed ws URL before opening a socket', async () => {
|
||||
const client = new JsonRpcGatewayClient()
|
||||
await expect(client.connect('ws://')).rejects.toThrow(/requires a ws:\/\/ or wss:\/\/ URL string/)
|
||||
expect(client.connectionState).toBe('idle')
|
||||
})
|
||||
|
||||
it('keeps connection state idle on rejection', async () => {
|
||||
const client = new JsonRpcGatewayClient()
|
||||
await client.connect(undefined as unknown as string).catch(() => undefined)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue