Skip to content

Commit

Permalink
tests: tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Jul 26, 2024
1 parent 44281e8 commit c05c1d2
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/utils/rpc/webSocket.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ describe('getWebSocketRpcClient', () => {
})

test('reconnect', async () => {
const socketClient = await getWebSocketRpcClient(anvilMainnet.rpcUrl.ws, {
reconnect: { delay: 100 },
})
const socketClient = await getWebSocketRpcClient(
'ws://127.0.0.1:8545/69420',
{
reconnect: { delay: 100 },
},
)
expect(socketClient).toBeDefined()
expect(socketClient.socket.readyState).toEqual(WebSocket.OPEN)
socketClient.socket.close()
Expand All @@ -44,9 +47,12 @@ describe('getWebSocketRpcClient', () => {
})

test('keepalive', async () => {
const socketClient = await getWebSocketRpcClient(anvilMainnet.rpcUrl.ws, {
keepAlive: { interval: 100 },
})
const socketClient = await getWebSocketRpcClient(
'ws://127.0.0.1:8545/69421',
{
keepAlive: { interval: 100 },
},
)
const spy = vi.spyOn(socketClient.socket, 'ping')
await wait(500)
expect(spy).toHaveBeenCalledTimes(4)
Expand Down

0 comments on commit c05c1d2

Please sign in to comment.