Description
It's very hard to test our endpoints without messing with global config/environment variables. We should make the endpoint tests dependency-injectable.
A possible path forward:
- the endpoint's functions are defined in separate modules;
- tests use jest.fn or otherwise to mock those functions
Desired behavior/Acceptance criteria (returned value, expected error, performance expectations, etc.)
- tests are insular and easier to express
Completion checklist
- Before closing this task, review one by one the checklist available here: https://www.mediawiki.org/wiki/Abstract_Wikipedia_team/Definition_of_Done#Back-end_Task/Bug_completion_checklist