-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathenvbuilder_test.go
52 lines (47 loc) · 1.08 KB
/
envbuilder_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
49
50
51
52
package envbuilder_test
import (
"testing"
"github.com/coder/envbuilder"
"github.com/stretchr/testify/require"
)
func TestDefaultWorkspaceFolder(t *testing.T) {
t.Parallel()
tests := []struct {
name string
gitURL string
expected string
}{
{
name: "HTTP",
gitURL: "https://github.com/coder/envbuilder.git",
expected: "/workspaces/envbuilder",
},
{
name: "SSH",
gitURL: "[email protected]:coder/envbuilder.git",
expected: "/workspaces/envbuilder",
},
{
name: "username and password",
gitURL: "https://username:[email protected]/coder/envbuilder.git",
expected: "/workspaces/envbuilder",
},
{
name: "fragment",
gitURL: "https://github.com/coder/envbuilder.git#feature-branch",
expected: "/workspaces/envbuilder",
},
{
name: "empty",
gitURL: "",
expected: envbuilder.EmptyWorkspaceDir,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
dir, err := envbuilder.DefaultWorkspaceFolder(tt.gitURL)
require.NoError(t, err)
require.Equal(t, tt.expected, dir)
})
}
}