Skip to content

Commit

Permalink
chore: coverage++
Browse files Browse the repository at this point in the history
Moved git worktree test into git public test.  Was no need
to create an internal test suite, as we are testing the public
worktree fn.
  • Loading branch information
retr0h committed Mar 9, 2024
1 parent c86d2b7 commit 188af7c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 91 deletions.
12 changes: 12 additions & 0 deletions internal/git/git_public_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package git_test

import (
"errors"
"fmt"
"log/slog"
"os"
"testing"
Expand Down Expand Up @@ -111,6 +112,17 @@ func (suite *GitManagerPublicTestSuite) TestWorktreeError() {
assert.Error(suite.T(), err)
}

func (suite *GitManagerPublicTestSuite) TestWorktreeErrorWhenAbsErrors() {
originalAbsFn := git.AbsFn
git.AbsFn = func(g *git.Git, _ string) (string, error) {
return "", fmt.Errorf("failed to get abs path")
}
defer func() { git.AbsFn = originalAbsFn }()

err := suite.gm.Worktree(suite.cloneDir, suite.gitVersion, suite.dstDir)
assert.Error(suite.T(), err)
}

func (suite *GitManagerPublicTestSuite) TestUpdateOk() {
suite.mockExec.EXPECT().
RunCmdInDir("git", []string{"fetch", "--tags", "--force"}, suite.cloneDir).
Expand Down
91 changes: 0 additions & 91 deletions internal/git/git_test.go

This file was deleted.

0 comments on commit 188af7c

Please sign in to comment.