-
Notifications
You must be signed in to change notification settings - Fork 64
chore(test): mock all request responses #376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This failure actually makes sense since the weather API test is failing on |
It looks like the weather site is just broken right now so the failure makes sense at this point of time But this is the kind of issues we get rid of by mocking the website responses like I'm doing in this PR. The fact that this PR and master is blocked on something that we can't change is pretty bad. |
Regenerated the mock json data in a more human readable form so that diffs will be better in the future and added a way to easily re-record mock data. |
The upstream data source is currently broken so we're disablign the test for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is amazing! Could you add something to the readme explaining how to update the mock-data?
@MiniGod How's this? |
I don't wanna tout my own horn but it's been really fun working in this PR with the really fast and consistent tests 🙏 |
This is AMAZING! You are not tooting your horn at all, we will have to call Gudni, the pineapple president to give you one of his fálkaorðas |
Great note about how to do the mock data for new endpoints. LGTM now. I love this PR so much. I and @kristjanmik were talking about apis.is last weekend, and how much it sucks that the tests fail if the sources are not up, and hence the automatic deploy fails too. This is seriously such an amazing PR! Kudos to @koddsson |
This patch adds mocked responses to all the requests made in the tests.
Here's how I generated the data in
mock-data.json
using nock:This means that our tests don't make any requests which has been a problem in the past. This enables us to mock future endpoints from the beginning and maybe we can start moving the mocked data into the tests and delete the json file in the future.