test: add unit coverage for comment helpers, token, git-config, and createInitialComment#1414
Open
mateuscmtropical wants to merge 2 commits into
Open
Conversation
Covers createJobRunLink, createBranchLink, createCommentBody and the SPINNER_HTML constant in src/github/operations/comments/common.ts, which previously sat at 20% line coverage. Verifies the markdown link formats, the default empty branch link, and the assembled comment body. Mutation score (StrykerJS): 100%. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
194e215 to
a09a212
Compare
setupGitHubToken and getOidcToken had no tests (23.7% line coverage for src/github/token.ts). Covers the override token short-circuit, the OIDC to app token exchange (headers, merged permissions body, token/app_token response fields), retry exhaustion on missing token and non-ok responses, the OIDC failure guidance message, and the workflow validation skip path that must not retry. Also adds boundary cases for parseAdditionalPermissions (empty key, empty value, no valid lines). The retry helper is module-mocked with the same semantics minus the backoff sleeps so failure paths run instantly. Mutation score (StrykerJS): 83.2%; every surviving mutant is either a console log string or an equivalent mutant (redundant trims and optional chaining on never-null objects). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
a09a212 to
24436db
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #1404. Adds unit tests for two more under-tested files in
src/github, both previously at low coverage. Tests only — no source changes.operations/comments/common.tstoken.tsNotes
token.ts(the OIDC → GitHub App token exchange) is IO-bound: tested withspyOnoncore.getIDTokenand globalfetch, reusingtest/mockContext.ts. The retry waits are mocked out so failure-path tests don't sleep.Validation
Mutation testing (StrykerJS)
The 6 token survivors are all equivalent mutants (redundant
trim()calls masked by a later check, and optional chaining on values that are never null at that point). No behavioral survivors.🤖 Generated with Claude Code