@@ -8,9 +8,10 @@ import (
88 "github.com/google/go-github/v55/github"
99 "github.com/jinzhu/copier"
1010 "github.com/stretchr/testify/assert"
11+ "github.com/stretchr/testify/require"
1112)
1213
13- var testBot * Bot = & Bot {
14+ var testBot = & Bot {
1415 ctx : context .Background (),
1516 issueClient : & testClient {},
1617}
@@ -50,7 +51,7 @@ func TestHandleEvent(t *testing.T) {
5051 }
5152 testEventCopy .IssueCommentEvent .Comment .Body = github .String ("/assign" )
5253 res , err := testBot .HandleEvent (ctx , testEventCopy )
53- assert .NoError (t , err )
54+ require .NoError (t , err )
5455 assert .NotEmpty (t , res )
5556 })
5657
@@ -67,7 +68,7 @@ func TestHandleEvent(t *testing.T) {
6768 }
6869 testEventCopy .IssueCommentEvent .Comment .Body = github .String ("/assign \r \n test body" )
6970 res , err := testBot .HandleEvent (ctx , testEventCopy )
70- assert .NoError (t , err )
71+ require .NoError (t , err )
7172 assert .NotEmpty (t , res )
7273 })
7374
@@ -84,7 +85,7 @@ func TestHandleEvent(t *testing.T) {
8485 }
8586 testEventCopy .IssueCommentEvent .Comment .Body = github .String ("/assign" )
8687 res , err := testBot .HandleEvent (ctx , testEventCopy )
87- assert .Error (t , err )
88+ require .Error (t , err )
8889 assert .NotEmpty (t , res )
8990 })
9091
@@ -99,7 +100,7 @@ func TestHandleEvent(t *testing.T) {
99100 }
100101 testEventCopy .IssueCommentEvent .Comment .Body = github .String ("assign" )
101102 res , err := testBot .HandleEvent (ctx , testEventCopy )
102- assert .NoError (t , err )
103+ require .NoError (t , err )
103104 assert .Equal (t , "no command found" , res )
104105 })
105106}
@@ -111,7 +112,7 @@ func TestCreateIssueComment(t *testing.T) {
111112 }
112113 testBot .issueClient = & tc
113114 err := testBot .CreateIssueComment ("test" , testEvent )
114- assert .Error (t , err )
115+ require .Error (t , err )
115116 })
116117
117118 t .Run ("create issue comment" , func (t * testing.T ) {
@@ -120,7 +121,7 @@ func TestCreateIssueComment(t *testing.T) {
120121 }
121122 testBot .issueClient = & tc
122123 err := testBot .CreateIssueComment ("test" , testEvent )
123- assert .NoError (t , err )
124+ require .NoError (t , err )
124125 })
125126
126127 t .Run ("create issue comment with empty body" , func (t * testing.T ) {
@@ -129,7 +130,7 @@ func TestCreateIssueComment(t *testing.T) {
129130 }
130131 testBot .issueClient = & tc
131132 err := testBot .CreateIssueComment ("" , testEvent )
132- assert .Error (t , err )
133+ require .Error (t , err )
133134 })
134135}
135136
@@ -140,7 +141,7 @@ func TestAssignIssueToCommenter(t *testing.T) {
140141 }
141142 testBot .issueClient = & tc
142143 assignee , err := testBot .AssignIssueToCommenter (testEvent )
143- assert .Error (t , err )
144+ require .Error (t , err )
144145 assert .Empty (t , assignee )
145146 })
146147
@@ -156,7 +157,7 @@ func TestAssignIssueToCommenter(t *testing.T) {
156157 }
157158 testEventCopy .IssueCommentEvent .Issue .Assignees = []* github.User {}
158159 assignee , err := testBot .AssignIssueToCommenter (testEventCopy )
159- assert .NoError (t , err )
160+ require .NoError (t , err )
160161 assert .Equal (t , "testCommentLogin" , assignee )
161162 })
162163
@@ -170,7 +171,7 @@ func TestAssignIssueToCommenter(t *testing.T) {
170171 }
171172 testEventCopy .IssueCommentEvent .Issue .State = github .String ("closed" )
172173 assignee , err := testBot .AssignIssueToCommenter (testEventCopy )
173- assert .Error (t , err )
174+ require .Error (t , err )
174175 assert .Empty (t , assignee )
175176 })
176177
@@ -184,7 +185,7 @@ func TestAssignIssueToCommenter(t *testing.T) {
184185 }
185186 testEventCopy .IssueCommentEvent .Issue .Assignees = []* github.User {{Login : github .String ("testCommentLogin" )}}
186187 assignee , err := testBot .AssignIssueToCommenter (testEventCopy )
187- assert .Error (t , err )
188+ require .Error (t , err )
188189 assert .Empty (t , assignee )
189190 })
190191
@@ -200,7 +201,7 @@ func TestAssignIssueToCommenter(t *testing.T) {
200201 }
201202 testEventCopy .IssueCommentEvent .Issue .Assignees = []* github.User {{Login : github .String ("testCommentLogin2" )}}
202203 assignee , err := testBot .AssignIssueToCommenter (testEventCopy )
203- assert .Error (t , err )
204+ require .Error (t , err )
204205 assert .Empty (t , assignee )
205206 })
206207}
0 commit comments