@@ -5,7 +5,7 @@ import { once } from "node:events";
5
5
import { WebSocketServer } from "ws" ;
6
6
import { createProxyServer , waitForConnect } from "@e9x/simple-socks" ;
7
7
import { getLocal , Mockttp , MockttpOptions } from "mockttp" ;
8
- import { Agent , Dispatcher , fetch , WebSocket } from "undici" ;
8
+ import { Agent , Dispatcher , fetch , MessageEvent , WebSocket } from "undici" ;
9
9
import { socksConnector , socksDispatcher } from "./index.js" ;
10
10
11
11
const kGlobalDispatcher = Symbol . for ( "undici.globalDispatcher.1" ) ;
@@ -259,13 +259,12 @@ it("should proxy WebSocket", async () => {
259
259
260
260
const ws = new WebSocket ( `ws://localhost:${ wsServer . port } ` ) ;
261
261
try {
262
- await once ( ws as any , "open" ) ;
262
+ await once ( ws , "open" ) ;
263
263
ws . send ( "Hello" ) ;
264
- const [ response ] = await once ( ws as any , "message" ) ;
264
+ const [ response ] : Array < MessageEvent < string > > = await once ( ws , "message" ) ;
265
265
266
266
assert . strictEqual ( response . data , "Hello" ) ;
267
267
assert . strictEqual ( wsServer . inbound . remotePort , plainProxy . outbound . localPort ) ;
268
-
269
268
} finally {
270
269
ws . close ( ) ;
271
270
global [ kGlobalDispatcher ] = undefined ;
0 commit comments