Closed GantMan closed 8 years ago
FYI, API is hard to bring into mocha tests :( So much stubbing needed.
@GantMan: @skellock and I came up with a reasonable way to handle this. Basically, we have parallel services, Api which calls the real api and FakeApi which calls the fixtures, and then in our saga index we override any erroring or absent endpoints with the fake method. For testing, we simply load up FakeApi and use it directly. It probably sounds clunky how I've described it, but in action it's actually pretty slick.
We might need to evaluate react-native-mock which claims to mock RN in entirety.
Fixtures have been added. This should be very testable now. Let's revisit.
We should add fixtures for our example API, along with a test that verifies the functions available on APIFixtures at least match the functions designated on API live. This helps stop a situation where someone renames or utilizes one and not the other. Result: a large time delay between the dev who worked on a project and maybe even had their PR accepted, and the network error they would cause.
This test is valuable in generated projects.
I'd like to see @fvonhoven implement this. Thoughts welcome @skellock