Skip to content

Commit c7af08b

Browse files
committed
test(gateway): avoid private socket access in TLS probe
1 parent baa4400 commit c7af08b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎src/gateway/client.test.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ class MockWebSocket {
8686
}
8787
}
8888

89+
setPeerFingerprint(fingerprint256: string): void {
90+
Object.defineProperty(this, "_socket", {
91+
configurable: true,
92+
value: { getPeerCertificate: () => ({ fingerprint256 }) },
93+
});
94+
}
95+
8996
on(event: "open", handler: WsEventHandlers["open"]): void;
9097
on(event: "message", handler: WsEventHandlers["message"]): void;
9198
on(event: "close", handler: WsEventHandlers["close"]): void;
@@ -777,7 +784,7 @@ describe("GatewayClient close handling", () => {
777784

778785
client.start();
779786
const ws = getLatestWs();
780-
ws._socket = { getPeerCertificate: () => ({ fingerprint256: "different" }) };
787+
ws.setPeerFingerprint("different");
781788
ws.emitOpen();
782789

783790
expect(onConnectError).toHaveBeenCalledWith(

0 commit comments

Comments
 (0)