mirror of
https://github.com/thegeeklab/wp-git-action.git
synced 2024-10-31 09:40:40 +00:00
33 lines
552 B
Go
33 lines
552 B
Go
package git
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"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) {
|
|
cmd := tt.repo.Init()
|
|
assert.Equal(t, tt.expected, cmd.Cmd.Args)
|
|
assert.Equal(t, tt.repo.WorkDir, cmd.Cmd.Dir)
|
|
})
|
|
}
|
|
}
|