forked from digitalocean/github-pr-resource
-
Notifications
You must be signed in to change notification settings - Fork 0
/
git_test.go
48 lines (44 loc) · 969 Bytes
/
git_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package resource
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestAppendDepth(t *testing.T) {
tests := []struct {
description string
args []string
depth int
expected []string
}{
{
description: "git clone depth 1",
args: []string{"git", "clone"},
depth: 1,
expected: []string{"git", "clone", "--depth", "1"},
},
{
description: "git clone no depth",
args: []string{"git", "clone"},
depth: 0,
expected: []string{"git", "clone"},
},
{
description: "no args no depth",
args: []string{},
depth: 0,
expected: []string{},
},
{
description: "no args with depth",
args: []string{},
depth: 5,
expected: []string{"--depth", "5"},
},
}
for _, tc := range tests {
t.Run(tc.description, func(t *testing.T) {
output := appendDepth(tc.args, tc.depth)
assert.Equal(t, tc.expected, output)
})
}
}