-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbranch_test.go
More file actions
66 lines (55 loc) · 1.76 KB
/
Copy pathbranch_test.go
File metadata and controls
66 lines (55 loc) · 1.76 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package glow_test
import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/meinto/glow"
. "github.com/meinto/glow/testutil"
)
var _ = Describe("Branch", func() {
var branches []Branch
BeforeEach(func() {
b1 := NewBranch("fix/author/feature")
b3, _ := NewAuthoredBranch("fix", "author", "feature")
b4, _ := AuthoredBranchFromBranchName("fix/author/feature")
branches = []Branch{b1, b3, b4}
})
It("is not allowed to be created from another branch", func() {
ForEachTestSet(branches, func(branch interface{}) {
Expect(branch.(Branch).CreationIsAllowedFrom(NewBranch("another-branch"))).To(BeFalse())
})
})
It("cannot be closed", func() {
ForEachTestSet(branches, func(branch interface{}) {
Expect(branch.(Branch).CanBeClosed()).To(BeFalse())
})
})
It("cannot be published", func() {
ForEachTestSet(branches, func(branch interface{}) {
Expect(branch.(Branch).CanBePublished()).To(BeFalse())
})
})
It("has no close branches", func() {
ForEachTestSet(branches, func(branch interface{}) {
closeBranches := branch.(Branch).CloseBranches(MockBranchCollection())
Expect(len(closeBranches)).To(Equal(0))
})
})
It("has no publish branch", func() {
ForEachTestSet(branches, func(branch interface{}) {
publishBranch := branch.(Branch).PublishBranch()
Expect(publishBranch).To(BeNil())
})
})
It("has a branch name", func() {
ForEachTestSet(branches, func(branch interface{}) {
branchName := branch.(Branch).BranchName()
Expect(branchName).To(Equal(BRANCH_NAME_PREFIX + "fix/author/feature"))
})
})
It("has a short branch name", func() {
ForEachTestSet(branches, func(branch interface{}) {
branchName := branch.(Branch).ShortBranchName()
Expect(branchName).To(Equal("fix/author/feature"))
})
})
})