fix: add missing mocks for off-service.js and searchOTC in backend tests
Run Tests on Branches / Detect Changes (push) Successful in 14s
Run Tests on Branches / Frontend Tests (push) Has been cancelled
Run Tests on Branches / Frontend Mobile Tests (push) Has been cancelled
Run Tests on Branches / Backend Tests (push) Has been cancelled

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.
This commit is contained in:
Antoni Nuñez Romeu
2026-07-13 21:10:06 +02:00
parent 6fa12b12d9
commit 20cc399731
+6
View File
@@ -3,6 +3,12 @@ import { jest } from '@jest/globals'
jest.unstable_mockModule('../cima-service.js', () => ({ jest.unstable_mockModule('../cima-service.js', () => ({
searchMedicines: jest.fn(async () => []), searchMedicines: jest.fn(async () => []),
getMedicineDetails: jest.fn(async () => null), 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', () => ({ jest.unstable_mockModule('../farmacias-webhook-import.js', () => ({