Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(test): say the archiver and proxy-agent stubs reach e2e too

Yudhi Armyndharisea59f987268e
diff --git a/test/__mocks__/archiver.ts b/test/__mocks__/archiver.ts
index 9c35c753c..605d44574 100644
--- a/test/__mocks__/archiver.ts
+++ b/test/__mocks__/archiver.ts
@@ -2,9 +2,10 @@
* Unit-test stub for `archiver` (ESM-only). ts-jest runs in CommonJS mode, so any source file that
* imports it — directly (StorageService) or transitively (anything that injects StorageService or a
* module built on it, e.g. StatusStoreService) — fails to parse without this stub once pulled into the
- * unit test graph. None of the unit suites exercise the tar/zip export path itself (that's covered by
- * the e2e config's real `archiver` via transformIgnorePatterns), so stubs for TarArchive and default
- * export are sufficient.
+ * unit test graph. None of the unit suites exercise the tar/zip export path itself, so stubs for
+ * TarArchive and default export are sufficient. Jest applies this stub in the e2e lane too (test/ is
+ * that config's rootDir); storage-export-streaming.e2e-spec.ts calls jest.unmock('archiver') to
+ * exercise the real tar/zip export path.
*/
interface TarArchiveStub {
diff --git a/test/__mocks__/https-proxy-agent.ts b/test/__mocks__/https-proxy-agent.ts
index 89926e587..21b191bd3 100644
--- a/test/__mocks__/https-proxy-agent.ts
+++ b/test/__mocks__/https-proxy-agent.ts
@@ -2,10 +2,11 @@
* Unit-test stub for `https-proxy-agent` (ESM-only since v8). 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.
+ * graph. The unit suites never open a real proxied socket, 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. Jest applies
+ * this stub in the e2e lane too (test/ is that config's rootDir), so a suite gets the real module only
+ * by calling jest.unmock('https-proxy-agent'), as baileys-proxy-agent.e2e-spec.ts does.
*/
import { Agent } from 'node:https';