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 {
3737 return emojiDocs
3838 case InfraPR :
3939 return emojiInfra
40+ case ReleasePR :
41+ return emojiRelease
4042 default :
4143 panic (fmt .Sprintf ("unrecognized PR type %v" , t ))
4244 }
@@ -55,6 +57,8 @@ func (t PRType) String() string {
5557 return "docs"
5658 case InfraPR :
5759 return "infra"
60+ case ReleasePR :
61+ return "release"
5862 default :
5963 panic (fmt .Sprintf ("unrecognized PR type %d" , int (t )))
6064 }
Original file line number Diff line number Diff line change @@ -16,7 +16,45 @@ limitations under the License.
1616
1717package main
1818
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+ }
2058
2159func Test_trimTitle (t * testing.T ) {
2260 tests := []struct {
You can’t perform that action at this time.
0 commit comments