Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a fake JSON server to mock File Upload Wizard API in JS unit tests
Normally we'd be mocking the web client library, but the two libraries I've tried are not reliable. axios-mock-adapter simply doesn't work with it succumbing to this issue: ctimmerm/axios-mock-adapter#116 (comment) Tried everything there, no success. Moxios, is the one I've first chosen and used in previous commits. It's older, not updated in years and more problematic is that it's prone to "heisenbugs", i.e: randomly breaking for no obvious reason. I haven't tried jasmine-ajax, but I figured it's much more time-effective and reliable to fake the API instead (we are talking about unit tests here, so they should be isolated from the real implementation). Bonus point is that we can use the fake API to test and prototype API endpoints with sample data before implementing for real (and thus being able to try multiple designs). In the future, we should revisiting the async mocking libraries as that's the long-term proper practice.
- Loading branch information