File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ func (t PRType) Emoji() string {
37
37
return emojiDocs
38
38
case InfraPR :
39
39
return emojiInfra
40
+ case ReleasePR :
41
+ return emojiRelease
40
42
default :
41
43
panic (fmt .Sprintf ("unrecognized PR type %v" , t ))
42
44
}
@@ -55,6 +57,8 @@ func (t PRType) String() string {
55
57
return "docs"
56
58
case InfraPR :
57
59
return "infra"
60
+ case ReleasePR :
61
+ return "release"
58
62
default :
59
63
panic (fmt .Sprintf ("unrecognized PR type %d" , int (t )))
60
64
}
Original file line number Diff line number Diff line change @@ -16,7 +16,45 @@ limitations under the License.
16
16
17
17
package main
18
18
19
- import "testing"
19
+ import (
20
+ "github.com/google/go-github/v32/github"
21
+ "testing"
22
+ )
23
+
24
+ func stringPointer (s string ) * string {
25
+ return & s
26
+ }
27
+
28
+ func Test_verifyPRType (t * testing.T ) {
29
+ tests := []struct {
30
+ name string
31
+ pr * github.PullRequest
32
+ want string
33
+ }{
34
+ {
35
+ name : "Bugfix PR" ,
36
+ pr : & github.PullRequest {
37
+ Title : stringPointer (":bug: Fixing bug" ),
38
+ },
39
+ want : "Found 🐛 PR (bugfix)" ,
40
+ },
41
+ {
42
+ name : "Release PR" ,
43
+ pr : & github.PullRequest {
44
+ Title : stringPointer (":rocket: Release v0.0.1" ),
45
+ },
46
+ want : "Found 🚀 PR (release)" ,
47
+ },
48
+ }
49
+
50
+ for _ , tt := range tests {
51
+ t .Run (tt .name , func (t * testing.T ) {
52
+ if got , _ , _ := verifyPRType (tt .pr ); got != tt .want {
53
+ t .Errorf ("verifyPRType() = %v, want %v" , got , tt .want )
54
+ }
55
+ })
56
+ }
57
+ }
20
58
21
59
func Test_trimTitle (t * testing.T ) {
22
60
tests := []struct {
You can’t perform that action at this time.
0 commit comments