-
Notifications
You must be signed in to change notification settings - Fork 62
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
Add integration tests for main.js
#56
Conversation
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.
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
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:
main
exits with an error whenGITHUB_REPOSITORY
is missing.main
exits with an error whenGITHUB_REPOSITORY_OWNER
is missing.main
successfully obtains a token when…owner
andrepositories
inputs are set (and the latter is a single repo).owner
andrepositories
inputs are set (and the latter is a list of repos).owner
input is set (to an org), but therepositories
input isn’t set.owner
input is set (to a user), but therepositories
input isn’t set.owner
input is not set, but therepositories
input is set.owner
norrepositories
input is set.❧
Architecturally, in order to keep individual tests concise, this PR adds
tests/main.js
, which:main.js
itself.The
tests/main-token-get-*.test.js
test files runtests/main.js
with various scenario-specific callback functions.