-
Notifications
You must be signed in to change notification settings - Fork 85
Add integration tests for main script and coverage #43
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
Comments
gr2m
pushed a commit
that referenced
this issue
Oct 6, 2023
Part of #43 This PR adds tests for [`main.js`](https://github.com/actions/create-github-app-token/blob/main/lib/main.js), similar to [the tests that already exist for `post.js`](https://github.com/actions/create-github-app-token/tree/main/tests). Specifically, it tests that: - `main` exits with an error when `GITHUB_REPOSITORY` is missing. - `main` exits with an error when `GITHUB_REPOSITORY_OWNER` is missing. - `main` successfully obtains a token when… - …the `owner` and `repositories` inputs are set (and the latter is a single repo). - …the `owner` and `repositories` inputs are set (and the latter is a list of repos). - …the `owner` input is set (to an org), but the `repositories` input isn’t set. - …the `owner` input is set (to a user), but the `repositories` input isn’t set. - …the `owner` input is not set, but the `repositories` input is set. - …neither the `owner` nor `repositories` input is set. ❧ Architecturally, in order to keep individual tests concise, this PR adds `tests/main.js`, which: - sets commonly-used inputs, environment variables, and mocks, then - calls a callback function that can edit the variables and add additional mocks, then - runs `main.js` itself. The `tests/main-token-get-*.test.js` test files run `tests/main.js` with various scenario-specific callback functions.
we can 🎉 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
follow up to #40 (comment)
The text was updated successfully, but these errors were encountered: