Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

test(contact): stub profile pictures with the id-keyed map shape

Yudhi Armyndharis558884fb0b9b
diff --git a/src/modules/contact/contact.controller.spec.ts b/src/modules/contact/contact.controller.spec.ts
index 5548e4551..dd72b1ebd 100644
--- a/src/modules/contact/contact.controller.spec.ts
+++ b/src/modules/contact/contact.controller.spec.ts
@@ -52,14 +52,14 @@ describe('ContactController', () => {
});
it('getProfilePictures splits, trims and drops empty ids', async () => {
- service.getProfilePictures.mockResolvedValue([null, 'https://pps/2.jpg']);
+ service.getProfilePictures.mockResolvedValue({ '[email protected]': null, '[email protected]': 'https://pps/2.jpg' });
const out = await controller.getProfilePictures('s1', ' [email protected] , ,[email protected] ');
expect(service.getProfilePictures).toHaveBeenCalledWith('s1', ['[email protected]', '[email protected]']);
- expect(out).toEqual({ pictures: [null, 'https://pps/2.jpg'] });
+ expect(out).toEqual({ pictures: { '[email protected]': null, '[email protected]': 'https://pps/2.jpg' } });
});
it('getProfilePictures defaults a missing ids param to an empty list', async () => {
- service.getProfilePictures.mockResolvedValue([]);
+ service.getProfilePictures.mockResolvedValue({});
await controller.getProfilePictures('s1');
expect(service.getProfilePictures).toHaveBeenCalledWith('s1', []);
});