-
Notifications
You must be signed in to change notification settings - Fork 5
/
integration.ts
38 lines (32 loc) · 948 Bytes
/
integration.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { WebSocketConn } from '../srpc/websocket.js'
import {
runClientTest,
runRpcStreamTest,
runAbortControllerTest,
} from '../echo/client-test.js'
import WebSocket from 'isomorphic-ws'
async function runRPC() {
const addr = 'ws://localhost:4352/demo'
console.log(`Connecting to ${addr}`)
const ws = new WebSocket(addr)
const channel = new WebSocketConn(ws, 'outbound')
const client = channel.buildClient()
console.log('Running client test via WebSocket..')
await runClientTest(client)
console.log('Running abort controller test via WebSocket..')
await runAbortControllerTest(client)
console.log('Running RpcStream test via WebSocket..')
await runRpcStreamTest(client)
}
process.on('unhandledRejection', (ev) => {
console.error('Unhandled rejection', ev)
throw ev
})
runRPC()
.then(() => {
process.exit(0)
})
.catch((err) => {
console.error('runRPC threw error', err)
process.exit(1)
})