gsquash/git/cmd_test.go
2023-12-05 19:03:27 +00:00

29 lines
551 B
Go

package git
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
// TestExecute runs a unit test with testify for git.Execute
func TestExecute(t *testing.T) {
require := require.New(t)
assert := assert.New(t)
// Create a new git
git := NewGit(&NewGitInput{
Executable: "git",
})
// Run the command
out, err := git.Execute("version")
// Assert that the command ran successfully
require.NoError(err)
// Assert that the output contains 'git version'
assert.Contains(out, "git version")
}