Skip to content

Commit b781a45

Browse files
committed
fix type coverage
1 parent d33e098 commit b781a45

File tree

2 files changed

+389
-496
lines changed

2 files changed

+389
-496
lines changed

index.spec.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { once } from "node:events";
55
import { WebSocketServer } from "ws";
66
import { createProxyServer, waitForConnect } from "@e9x/simple-socks";
77
import { getLocal, Mockttp, MockttpOptions } from "mockttp";
8-
import { Agent, Dispatcher, fetch, WebSocket } from "undici";
8+
import { Agent, Dispatcher, fetch, MessageEvent, WebSocket } from "undici";
99
import { socksConnector, socksDispatcher } from "./index.js";
1010

1111
const kGlobalDispatcher = Symbol.for("undici.globalDispatcher.1");
@@ -259,13 +259,12 @@ it("should proxy WebSocket", async () => {
259259

260260
const ws = new WebSocket(`ws://localhost:${wsServer.port}`);
261261
try {
262-
await once(ws as any, "open");
262+
await once(ws, "open");
263263
ws.send("Hello");
264-
const [response] = await once(ws as any, "message");
264+
const [response]: Array<MessageEvent<string>> = await once(ws, "message");
265265

266266
assert.strictEqual(response.data, "Hello");
267267
assert.strictEqual(wsServer.inbound.remotePort, plainProxy.outbound.localPort);
268-
269268
} finally {
270269
ws.close();
271270
global[kGlobalDispatcher] = undefined;

0 commit comments

Comments
 (0)