-
Notifications
You must be signed in to change notification settings - Fork 115
Add integration tests for main.js
#56
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
gr2m
left a comment
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.
I prefer we don't use any module mocking, instead mock all requests and capture and snapshot all logs / thrown errors. Let me know if you need help with that
👍 Cool; removed
I added a happy path test (that mocks requests and validates stdout), in https://github.com/smockle/create-github-app-token/pull/56/commits/43f24998742aeb378c1e91e0fe6a0d790a0a6b92. @gr2m, is that what you had in mind? |
This comment was marked as outdated.
This comment was marked as outdated.
main.js
…SITORY' is missing
…rl' only when 'GITHUB_API_URL' is set
…t 'baseUrl' only when 'GITHUB_API_URL' is set" This reverts commit 9d87259.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
gr2m
left a comment
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.
just a nit that we an also address later 👍🏼
…ning about using top-level await outside a module
gr2m
left a comment
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.
great, let's ship it 👍🏼
|
🎉 This PR is included in version 1.5.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Part of #43
This PR adds tests for
main.js, similar to the tests that already exist forpost.js.Specifically, it tests that:
mainexits with an error whenGITHUB_REPOSITORYis missing.mainexits with an error whenGITHUB_REPOSITORY_OWNERis missing.mainsuccessfully obtains a token when…ownerandrepositoriesinputs are set (and the latter is a single repo).ownerandrepositoriesinputs are set (and the latter is a list of repos).ownerinput is set (to an org), but therepositoriesinput isn’t set.ownerinput is set (to a user), but therepositoriesinput isn’t set.ownerinput is not set, but therepositoriesinput is set.ownernorrepositoriesinput is set.❧
Architecturally, in order to keep individual tests concise, this PR adds
tests/main.js, which:main.jsitself.The
tests/main-token-get-*.test.jstest files runtests/main.jswith various scenario-specific callback functions.