0
0
mirror of https://github.com/thegeeklab/wp-git-action.git synced 2024-11-09 17:10:41 +00:00
wp-git-action/git/init_test.go

24 lines
448 B
Go
Raw Normal View History

package git
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestInit(t *testing.T) {
repo := Repository{
WorkDir: "/path/to/repo",
}
cmd := Init(repo)
require.Equal(t, []string{gitBin, "init"}, cmd.Cmd.Args)
require.Equal(t, repo.WorkDir, cmd.Cmd.Dir)
// Test with an empty work directory
repo.WorkDir = ""
cmd = Init(repo)
require.Equal(t, []string{gitBin, "init"}, cmd.Cmd.Args)
require.Empty(t, cmd.Cmd.Dir)
}