commit 1
This commit is contained in:
28
git/cmd_test.go
Normal file
28
git/cmd_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
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")
|
||||
}
|
||||
Reference in New Issue
Block a user