forked from samcontesse/gitlab-merge-request-resource
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel_test.go
42 lines (32 loc) · 967 Bytes
/
model_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
package resource
import "testing"
func TestSource_GetProjectPath_WithNamespace(t *testing.T) {
source := Source{
URI: "https://git.example.com/namespace/project.git",
}
actual := source.GetProjectPath()
expected := "namespace/project"
if actual != expected {
t.Errorf("Project path %s expected to be %s", actual, expected)
}
}
func TestSource_GetProjectPath_WithSubgroup(t *testing.T) {
source := Source{
URI: "https://git.example.com/group/subgroup1/subgroup2/project.git",
}
actual := source.GetProjectPath()
expected := "group/subgroup1/subgroup2/project"
if actual != expected {
t.Errorf("Project path %s expected to be %s", actual, expected)
}
}
func TestSource_GetProjectPath_WithoutNamespace(t *testing.T) {
source := Source{
URI: "https://git.example.com/project.git",
}
actual := source.GetProjectPath()
expected := "project"
if actual != expected {
t.Errorf("Project path %s expected to be %s", actual, expected)
}
}