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

33 lines
552 B
Go
Raw Normal View History

package git
import (
"testing"
2024-05-06 19:04:48 +00:00
"github.com/stretchr/testify/assert"
)
func TestInit(t *testing.T) {
tests := []struct {
name string
repo Repository
expected []string
}{
{
name: "init repo",
repo: Repository{
WorkDir: "/path/to/repo",
Branch: "main",
},
expected: []string{gitBin, "init", "-b", "main"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
2024-05-06 18:29:57 +00:00
cmd := tt.repo.Init()
2024-05-06 19:04:48 +00:00
assert.Equal(t, tt.expected, cmd.Cmd.Args)
assert.Equal(t, tt.repo.WorkDir, cmd.Cmd.Dir)
})
}
}