Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
chore: fix lint errors in specs and proxy agent mocks
Yudhi Armyndharis0e8ac7536b0d
diff --git a/src/engine/adapters/whatsapp-web-js.adapter.spec.ts b/src/engine/adapters/whatsapp-web-js.adapter.spec.tsindex a889c4297..859ed3bfd 100644--- a/src/engine/adapters/whatsapp-web-js.adapter.spec.ts+++ b/src/engine/adapters/whatsapp-web-js.adapter.spec.ts@@ -4789,7 +4789,7 @@ describe('WhatsAppWebJsAdapter puppeteer death detection (browser/page silent depupBrowser: new EventEmitter(),pupPage: new EventEmitter(),...overrides.client,- }) as PuppeteerFakeClient;+ });const onDisconnected = jest.fn();(adapter as unknown as { client: unknown }).client = client;(adapter as unknown as { callbacks: unknown }).callbacks = { onDisconnected };@@ -4957,7 +4957,7 @@ describe('WhatsAppWebJsAdapter navigation re-inject grace (#1081)', () => {pupBrowser: new EventEmitter(),pupPage: new EventEmitter(),...clientOverrides,- }) as NavFakeClient;+ });(adapter as unknown as { client: unknown }).client = client;(adapter as unknown as { callbacks: unknown }).callbacks = {};(adapter as unknown as { status: EngineStatus }).status = EngineStatus.READY;@@ -6818,7 +6818,7 @@ describe('WhatsAppWebJsAdapter account-restriction reporting', () => {const client = Object.assign(new EventEmitter(), {getState: jest.fn().mockResolvedValue(WAState.CONNECTED),pupPage: { evaluate: jest.fn().mockResolvedValue(true) },- }) as FakeClient;+ });const onAccountRestriction = jest.fn();const onDisconnected = jest.fn();(adapter as unknown as { client: unknown }).client = client;diff --git a/src/modules/auth/auth.service.spec.ts b/src/modules/auth/auth.service.spec.tsindex 345a2872e..08789a344 100644--- a/src/modules/auth/auth.service.spec.ts+++ b/src/modules/auth/auth.service.spec.ts@@ -182,18 +182,18 @@ describe('AuthService', () => {setParameters() {return this;},- async execute(): Promise<{ affected: number }> {+ execute(): Promise<{ affected: number }> {const target = keys.get(this.targetId as string);- if (!target) return { affected: 0 };+ if (!target) return Promise.resolve({ affected: 0 });const guardPasses =!this.guarded ||!isUsableAdminRow(target) ||[...keys.values()].some(k => k.id !== target.id && isUsableAdminRow(k));- if (!guardPasses) return { affected: 0 };+ if (!guardPasses) return Promise.resolve({ affected: 0 });if (this.mode === 'delete') keys.delete(this.targetId as string);else Object.assign(target, this.patch ?? {});committedWrites.push({ mode: this.mode, patch: this.patch, guarded: this.guarded });- return { affected: 1 };+ return Promise.resolve({ affected: 1 });},};return qb;diff --git a/test/__mocks__/https-proxy-agent.ts b/test/__mocks__/https-proxy-agent.tsindex b6eeabb82..89926e587 100644--- a/test/__mocks__/https-proxy-agent.ts+++ b/test/__mocks__/https-proxy-agent.ts@@ -12,7 +12,7 @@ import { Agent } from 'node:https';export class HttpsProxyAgent extends Agent {readonly proxy: string;- constructor(proxy: string | URL, _options?: Record<string, unknown>) {+ constructor(proxy: string | URL) {super();this.proxy = String(proxy);}diff --git a/test/__mocks__/socks-proxy-agent.ts b/test/__mocks__/socks-proxy-agent.tsindex a4cf1ffc6..27e63d6ce 100644--- a/test/__mocks__/socks-proxy-agent.ts+++ b/test/__mocks__/socks-proxy-agent.ts@@ -12,7 +12,7 @@ import { Agent } from 'node:https';export class SocksProxyAgent extends Agent {readonly proxy: string;- constructor(proxy: string | URL, _options?: Record<string, unknown>) {+ constructor(proxy: string | URL) {super();this.proxy = String(proxy);}