Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(test): say the socks-proxy-agent stub also runs in e2e

Yudhi Armyndharisda94945466e8
diff --git a/test/__mocks__/socks-proxy-agent.ts b/test/__mocks__/socks-proxy-agent.ts
index f139bade8..8e42463dd 100644
--- a/test/__mocks__/socks-proxy-agent.ts
+++ b/test/__mocks__/socks-proxy-agent.ts
@@ -2,11 +2,13 @@
* Unit-test stub for `socks-proxy-agent` (ESM-only since v9). ts-jest runs in CommonJS mode, so any
* source file that imports it — directly (baileys-lifecycle) or transitively (anything that pulls in
* the engine adapters) — fails to load without this stub once the package lands in the unit test
- * graph. The unit suites never open a real proxied socket (the e2e config exercises the real module
- * via transformIgnorePatterns), so a class that records the proxy URL and satisfies the `Agent`
- * return type of createProxyAgent is sufficient — and because the spec's `instanceof` checks import
- * the same mapped module, they run against this very class. `proxy` mirrors the library's parsed
- * object (parseSocksURL: `host` is URL.hostname, brackets included for an IPv6 literal).
+ * graph. Jest applies this stub in the e2e lane too (test/ is that config's rootDir, so test/__mocks__
+ * stubs node modules there automatically), and no e2e suite calls jest.unmock('socks-proxy-agent'),
+ * so the real module runs in no test lane. No suite opens a real SOCKS connection, so a class that
+ * records the proxy URL and satisfies the `Agent` return type of createProxyAgent is sufficient, and
+ * because the spec's `instanceof` checks import the same mapped module, they run against this very
+ * class. `proxy` mirrors the library's parsed object (parseSocksURL: `host` is URL.hostname, brackets
+ * included for an IPv6 literal).
*/
import { Agent } from 'node:https';