From 3a082877dd3e9c1d9dba6e2c1857921886b6c9e5 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/backend/__tests__/server.test.js b/apps/backend/__tests__/server.test.js index c252983..6e38f9e 100644 --- a/apps/backend/__tests__/server.test.js +++ b/apps/backend/__tests__/server.test.js @@ -6,6 +6,11 @@ jest.unstable_mockModule('../cima-service.js', () => ({ 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', () => ({ runFarmaciaWebhookImport: jest.fn(async () => ({})), DEFAULT_FARMACIAS_WEBHOOK: '',