test(cli): add unit tests for PM/SCM commands and cliCommandFactory#944
Merged
test(cli): add unit tests for PM/SCM commands and cliCommandFactory#944
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
nhopeatall
approved these changes
Mar 17, 2026
Collaborator
nhopeatall
left a comment
There was a problem hiding this comment.
Summary
LGTM — Well-structured test suite that closes coverage gaps for PM/SCM CLI commands and cliCommandFactory. All 62 tests correctly verify CLI → core function wiring, with proper mocking of credential-scoping dependencies and core functions. CI is green.
Code Issues
Nitpick
- tests/unit/cli/cli-command-factory.test.ts:44 — Unused
mockConfigconst. ThemakeMockConfig()factory is correctly used everywhere, but the oldconst mockConfigon line 44 was left behind as dead code. Minor cleanup opportunity.
🕵️ claude-code · claude-opus-4-6 · run details
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
Closes https://trello.com/c/lyc2vG0V/463-as-a-developer-i-want-unit-tests-for-pm-scm-tool-commands-and-clicommandfactory-so-that-agent-tool-coverage-gaps-are-closed
read-work-item,list-work-items,move-work-item,delete-checklist-item,update-checklist-item,create-work-item,post-commentget-pr-details,get-pr-diff,get-pr-checks,get-pr-comments,get-ci-run-logs,post-pr-comment,reply-to-review-comment,update-pr-commentcliCommandFactorycovering all flag types, gadgetOnly exclusion, file-input resolution, owner/repo auto-resolution, and JSON output formatNew test files
tests/unit/cli/pm/pm-commands.test.ts— 19 teststests/unit/cli/scm/scm-commands.test.ts— 24 teststests/unit/cli/cli-command-factory.test.ts— 19 testsTest plan
Key decisions
makeMockConfig()factory function (not a shared const) so each test gets a freshrunHookmock that isn't cleared byvi.restoreAllMocks()inafterEachwithGitHubToken,withTrelloCredentials,withJiraCredentials,createPMProvider,withPMProvider) to isolate CLI command logic — matching the pattern fromfile-input-flags.test.tsCASCADE_REPO_OWNER/CASCADE_REPO_NAMEenv vars inbeforeEachfor SCM tests that use auto-resolved owner/reporeadWorkItemDefdefinesincludeCommentswithdefault: true, so tests verify the boolean flag correctly passestrueby default andfalsewith--no-includeComments🤖 Generated with Claude Code
🕵️ claude-code · claude-sonnet-4-6 · run details