Open Oliversw opened 6 years ago
Mocking API calls is real tricky! It's awesome that you've given it some consideration.
I would say you don't have to try and test the actual implementation of the API - that's the job of whoever is making the API. But the interesting things to test are what your app does based on conditions - or what data is being fed to it, basically.
There's a module called nock that does this that's pretty cool, and Jest has a big section in its documentation about putting mocks together as well. I think it's probably a bit more of homework reading than something to look into today - the takeaway here is that you've started thinking about it and that's great :+1:
Thanks for the info! Will have a look at nock 😸
You have some tests, amazing! That's more than we managed 😅
Still, I ran npm test and wasn't able to get them to run properly, so wanted to point that out!