Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

test(engine): pin the lid mapping store hop into the wwebjs adapter

Yudhi Armyndharis0be3f80c9d6b
diff --git a/src/engine/builtin/whatsapp-web-js/index.spec.ts b/src/engine/builtin/whatsapp-web-js/index.spec.ts
index 9db3bf5df..db8f03684 100644
--- a/src/engine/builtin/whatsapp-web-js/index.spec.ts
+++ b/src/engine/builtin/whatsapp-web-js/index.spec.ts
@@ -5,6 +5,7 @@ jest.mock('../../adapters/whatsapp-web-js.adapter', () => ({
import { WhatsAppWebJsPlugin } from './index';
import { WhatsAppWebJsAdapter } from '../../adapters/whatsapp-web-js.adapter';
import { PluginContext } from '../../../core/plugins';
+import type { LidMappingStore } from '../../identity/lid-mapping-store.service';
describe('WhatsAppWebJsPlugin.createEngine (opaque config)', () => {
beforeEach(() => {
@@ -47,6 +48,14 @@ describe('WhatsAppWebJsPlugin.createEngine (opaque config)', () => {
);
});
+ it('threads the shared lid mapping store to the adapter', () => {
+ const lidMappingStore = {} as LidMappingStore;
+
+ new WhatsAppWebJsPlugin(undefined, lidMappingStore).createEngine({ sessionId: 's' });
+
+ expect(WhatsAppWebJsAdapter).toHaveBeenCalledWith(expect.objectContaining({ lidMappingStore }));
+ });
+
it('falls back to safe defaults when context has no config, leaving the flag list to the adapter', () => {
const plugin = new WhatsAppWebJsPlugin();