-
Notifications
You must be signed in to change notification settings - Fork 24
/
main_test.go
34 lines (25 loc) · 1.06 KB
/
main_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
package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestProjectsFromBuildProjects(t *testing.T) {
assert := assert.New(t)
p1 := Project{Label: "project1", Path: []string{"project1/"}, Skip: []string{}}
p2 := Project{Label: "project2", Path: []string{"project2/"}, Skip: []string{}}
p3 := Project{Label: "project3", Path: []string{"project3/"}, Skip: []string{}}
projects := []Project{p1, p2, p3}
projectNames := "project1,project3"
filteredList := projectsFromBuildProjects(projectNames, projects)
assert.Equal(filteredList, []Project{p1, p3})
}
func TestAllProjectsFromBuildProjects(t *testing.T) {
assert := assert.New(t)
p1 := Project{Label: "project1", Path: []string{"project1/"}, Skip: []string{}}
p2 := Project{Label: "project2", Path: []string{"project2/"}, Skip: []string{}}
p3 := Project{Label: "project3", Path: []string{"project3/"}, Skip: []string{}}
projects := []Project{p1, p2, p3}
projectNames := "*"
filteredList := projectsFromBuildProjects(projectNames, projects)
assert.Equal(filteredList, []Project{p1, p2, p3})
}