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

fix: free non contributor swag #7

Merged
merged 5 commits into from Oct 22, 2018

Conversation

chadfawcett
Copy link
Contributor

@chadfawcett chadfawcett commented Oct 16, 2018

Currently anyone can request a discount code and redeem free swag. This resolves that by awaiting the response from isGitHubContributor.

const contributor = await isGitHubContributor(username);

I've added some tests to hopefully catch any regressions. I'm not 💯happy with my tests. I refactored the mocks and fixtures for @octokit/rest in or to be more reusable. I would have preferred if I could have gotten the whole class auto mocked by jest and then add a mockImplementation for search.issues, but I couldn't get it working because it's a class. I might be able to take another crack at it with fresh eyes tomorrow.

The added routes/store tests work, but I'm not super happy with them either. I tried to test the router directly by calling express' router.handle function. The nice thing about it is that we don't have to spin up the app using something like supertest, but the downside is the callback-y-ness.

I wanted to submit the PR before heading off to bed, so I may do some refactoring tomorrow but I wanted to get your thoughts.

@chadfawcett chadfawcett changed the title Fix free non contributor swag fix: free non contributor swag Oct 18, 2018
@jlengstorf
Copy link
Contributor

This looks great. Thanks, @chadfawcett!

For the tests, this looks pretty good to me. Don't worry about the store route too much because I'm about to do a refactor to change this from a REST API to a GraphQL API, which means the routes are going to change very soon.

Thanks again!

@jlengstorf jlengstorf merged commit 6717429 into gatsbyjs:master Oct 22, 2018
@chadfawcett chadfawcett deleted the fix-free-non-contributor-swag branch October 22, 2018 19:01
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

Successfully merging this pull request may close these issues.

None yet

2 participants