Skip to content
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

Alternative strategy for mocking github interactions #28

Open
chris48s opened this issue Jul 4, 2021 · 1 comment
Open

Alternative strategy for mocking github interactions #28

chris48s opened this issue Jul 4, 2021 · 1 comment

Comments

@chris48s
Copy link
Member

chris48s commented Jul 4, 2021

#9 made breaking changes, but all the tests passed

The approach I've taken so far was to test all my own code but inject stubs that mock out the external interactions and then check the mocks were called with the right params.

Then this update came along and all the tests passed, because my tests were checking that my client.repos mock was getting called with the right arguments. The fact that the upstream library now exposed that object on client.rest.repos was irrelevant because under test a mock still existed for client.repos 🙃

I guess the next step to try on this journey is to find a solution that uses something like nock to fake the github responses so you're still making real calls to octokit, but it is receiving fake pre-canned HTTP responses instead of actually communicating with GitHub. Then you've hopefully got an integration test that fails on breaking changes to the octokit lib.

@chris48s
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant