Migrate pkg/cli/git_test.go to testify assertions#34775
Merged
pelikhan merged 3 commits intoMay 25, 2026
Conversation
Closed
8 tasks
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Migrate pkg/cli/git_test.go to use testify assertions
Migrate May 25, 2026
pkg/cli/git_test.go to testify assertions
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates pkg/cli/git_test.go to use the repository’s standard testify assertion style (require for prerequisites and assert for behavioral checks) while keeping the existing Git-related test scenarios and structure intact.
Changes:
- Replaced setup-time
t.Fatal*/t.Error*checks withrequire.NoErrorwhere test execution cannot proceed on failure. - Replaced behavioral validations with targeted
assert.*calls (e.g.,Equal,Contains,Error,Empty,True/False). - Split compound workflow status checks into explicit assertions for clearer failure output.
Show a summary per file
| File | Description |
|---|---|
pkg/cli/git_test.go |
Migrates Git unit tests to testify (assert/require) for clearer, more consistent assertions without changing test behavior. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
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.
pkg/cli/git_test.gohad solid coverage but still relied on rawt.Fatal*/t.Error*checks throughout. This updates the file to use the repository’s standardtestifyassertion style while preserving the existing Git test scenarios and table-driven structure.Adopt
requirefor setup and execution prerequisitest.Fatalf(...)calls withrequire.NoError(...)for temp dir setup, repo initialization steps, file creation, and command execution that must succeed for the test to remain valid.Adopt
assertfor behavioral checkst.Error(...)/t.Errorf(...)checks with targetedassert.*calls such as:assert.Equal(...)for branch names, hosts, remote names, and repository slugsassert.Contains(...)for commit log validationassert.Error(...)for expected failure pathsassert.True(...)/assert.False(...)/assert.Empty(...)/assert.NotEmpty(...)for status and presence checksSplit compound status checks into explicit assertions
IsModified,IsStaged, andHasUnpushedCommitsindependently, which makes failures more precise and easier to diagnose.Keep test behavior unchanged
Example of the assertion style change: