mirror of
https://github.com/thegeeklab/wp-git-clone.git
synced 2024-11-24 23:10:40 +00:00
32 lines
594 B
Go
32 lines
594 B
Go
|
package git
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestRemoteAdd(t *testing.T) {
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
repo Repository
|
||
|
want []string
|
||
|
}{
|
||
|
{
|
||
|
name: "add remote with valid inputs",
|
||
|
repo: Repository{
|
||
|
RemoteURL: "https://example.com/repo.git",
|
||
|
},
|
||
|
want: []string{gitBin, "remote", "add", "origin", "https://example.com/repo.git"},
|
||
|
},
|
||
|
}
|
||
|
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
cmd := tt.repo.RemoteAdd()
|
||
|
assert.Equal(t, tt.want, cmd.Cmd.Args)
|
||
|
assert.Equal(t, tt.repo.WorkDir, cmd.Cmd.Dir)
|
||
|
})
|
||
|
}
|
||
|
}
|