From 20cc39973173657cbc0e7fdae92e54cba812e0ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoni=20Nu=C3=B1ez=20Romeu?= Date: Mon, 13 Jul 2026 21:10:06 +0200 Subject: [PATCH] fix: add missing mocks for off-service.js and searchOTC in backend tests The backend test was hanging in CI because server.js imports off-service.js which pulls in redis-client.js. Without a mock, it tries to connect to Redis at import time, hanging indefinitely in CI where no Redis server exists. Also added the missing searchOTC mock for cima-service.js to fix the SyntaxError from the export mismatch. --- apps/backend/__tests__/server.test.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/backend/__tests__/server.test.js b/apps/backend/__tests__/server.test.js index 5a52cb4..6e38f9e 100644 --- a/apps/backend/__tests__/server.test.js +++ b/apps/backend/__tests__/server.test.js @@ -3,6 +3,12 @@ import { jest } from '@jest/globals' jest.unstable_mockModule('../cima-service.js', () => ({ searchMedicines: jest.fn(async () => []), getMedicineDetails: jest.fn(async () => null), + searchOTC: jest.fn(async () => []), +})) + +jest.unstable_mockModule('../off-service.js', () => ({ + searchBabyProducts: jest.fn(async () => []), + getBabyProductDetails: jest.fn(async () => null), })) jest.unstable_mockModule('../farmacias-webhook-import.js', () => ({