Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
test(search): pass a session scope the controller must ignore
Yudhi Armyndharis0e1633bb947f
diff --git a/src/modules/search/search.controller.spec.ts b/src/modules/search/search.controller.spec.tsindex 7357b93bc..20659fd77 100644--- a/src/modules/search/search.controller.spec.ts+++ b/src/modules/search/search.controller.spec.ts@@ -51,10 +51,11 @@ describe('SearchController', () => {// `sessionIds` is not a field on SearchQueryDto, so it cannot be expressed in the query at all;// the global ValidationPipe (forbidNonWhitelisted) would reject it, and SearchService clobbers// any sessionIds at the provider boundary. The controller itself derives scope solely from the- // key — here there is no key → undefined.- const dto: SearchQueryDto = { q: 'hello' };- await ctrl.search(dto, undefined);- expect(search).toHaveBeenCalledWith(dto, undefined);+ // key, even when a sessionIds value reaches it.+ const dto = { q: 'hello', sessionIds: ['sneaky'] } as unknown as SearchQueryDto;+ const apiKey = { allowedSessions: ['s1'] } as unknown as ApiKey;+ await ctrl.search(dto, apiKey);+ expect(search).toHaveBeenCalledWith(dto, ['s1']);});it('propagates 501 (NotImplementedException) from the service when no provider is active', async () => {