fix/backend-test-mocks #34

Merged
Ichitux merged 13 commits from fix/backend-test-mocks into main 2026-07-13 19:20:44 +00:00

13 Commits

Author SHA1 Message Date
Antoni Nuñez Romeu 5ae3ebecee ci: consolidate test jobs into single workflow with npm caching
Run Tests on Branches / Run Tests (push) Successful in 1m44s
- Merge 3 parallel test jobs (backend/frontend/mobile) into one sequential job
- Remove dependency on dorny/paths-filter@v3 (replaced with git diff script)
- Add npm cache via setup-node to speed up dependency installation
- Downgrade Node.js from 24 to 22 LTS for stability
- Reduce checkout fetch-depth from full history to 2 commits
2026-07-13 21:16:46 +02:00
Antoni Nuñez Romeu 20cc399731 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.
2026-07-13 21:10:06 +02:00
Antoni Nuñez Romeu 6fa12b12d9 fix: address code review issues — nutriscore field name, cache write isolation, missing rate limiter, dead props 2026-07-13 20:58:41 +02:00
Antoni Nuñez Romeu 731b51ff48 feat: display product results alongside medicine results in MedicineResults component 2026-07-13 20:58:41 +02:00
Antoni Nuñez Romeu ca4a9671e7 feat(mobile): add product detail screen for CIMA and OFF products 2026-07-13 20:58:41 +02:00
Antoni Nuñez Romeu 241d362528 feat(mobile): integrate product search with filter tabs in search screen 2026-07-13 20:58:41 +02:00
Antoni Nuñez Romeu 13cf7b66ee feat(mobile): add products API service with search and detail endpoints 2026-07-13 20:58:41 +02:00
Antoni Nuñez Romeu 39868d95c6 feat(frontend): integrate product search into PublicView with filter tabs 2026-07-13 20:58:41 +02:00
Antoni Nuñez Romeu 2d839b9082 feat(frontend): add ProductResults component for unified product search
Displays CIMA OTC and Open Food Facts baby products with source/category
badges, product images, brand info, and Nutri-Score for OFF items.
2026-07-13 20:58:41 +02:00
Antoni Nuñez Romeu 1a2e9aafb2 Add unified product search routes (CIMA OTC + Open Food Facts)
- GET /api/products/search?q={query} - parallel search across both sources
- GET /api/products/:source/:id - product detail by source (cima/openfoodfacts)
- Uses Promise.allSettled for fault-tolerant parallel search
- Added imports for searchOTC and OFF service functions
2026-07-13 20:58:40 +02:00
Antoni Nuñez Romeu edfe7d6390 feat(backend): add CIMA OTC search function with Redis caching 2026-07-13 20:58:40 +02:00
Antoni Nuñez Romeu b7ca3633e6 fix: remove dead BABY_CATEGORIES constant and emoji from logs 2026-07-13 20:58:40 +02:00
Antoni Nuñez Romeu e48ef31fee feat(backend): add Open Food Facts service with Redis caching
- transformOFFProduct: maps OFF products to unified Product model
- searchBabyProducts: searches baby products via OFF API (1h cache)
- getBabyProductDetails: fetches product details by barcode (1h cache)
- 9 tests passing for transform logic and input validation
2026-07-13 20:58:40 +02:00