@@ -10,7 +10,7 @@ import (
10
10
"github.com/stretchr/testify/assert"
11
11
)
12
12
13
- var testBot * Bot = & Bot {
13
+ var testBot = & Bot {
14
14
ctx : context .Background (),
15
15
issueClient : & testClient {},
16
16
}
@@ -50,7 +50,7 @@ func TestHandleEvent(t *testing.T) {
50
50
}
51
51
testEventCopy .IssueCommentEvent .Comment .Body = github .String ("/assign" )
52
52
res , err := testBot .HandleEvent (ctx , testEventCopy )
53
- assert .NoError (t , err )
53
+ require .NoError (t , err )
54
54
assert .NotEmpty (t , res )
55
55
})
56
56
@@ -67,7 +67,7 @@ func TestHandleEvent(t *testing.T) {
67
67
}
68
68
testEventCopy .IssueCommentEvent .Comment .Body = github .String ("/assign \r \n test body" )
69
69
res , err := testBot .HandleEvent (ctx , testEventCopy )
70
- assert .NoError (t , err )
70
+ require .NoError (t , err )
71
71
assert .NotEmpty (t , res )
72
72
})
73
73
@@ -84,7 +84,7 @@ func TestHandleEvent(t *testing.T) {
84
84
}
85
85
testEventCopy .IssueCommentEvent .Comment .Body = github .String ("/assign" )
86
86
res , err := testBot .HandleEvent (ctx , testEventCopy )
87
- assert .Error (t , err )
87
+ require .Error (t , err )
88
88
assert .NotEmpty (t , res )
89
89
})
90
90
@@ -99,7 +99,7 @@ func TestHandleEvent(t *testing.T) {
99
99
}
100
100
testEventCopy .IssueCommentEvent .Comment .Body = github .String ("assign" )
101
101
res , err := testBot .HandleEvent (ctx , testEventCopy )
102
- assert .NoError (t , err )
102
+ require .NoError (t , err )
103
103
assert .Equal (t , "no command found" , res )
104
104
})
105
105
}
@@ -111,7 +111,7 @@ func TestCreateIssueComment(t *testing.T) {
111
111
}
112
112
testBot .issueClient = & tc
113
113
err := testBot .CreateIssueComment ("test" , testEvent )
114
- assert .Error (t , err )
114
+ require .Error (t , err )
115
115
})
116
116
117
117
t .Run ("create issue comment" , func (t * testing.T ) {
@@ -120,7 +120,7 @@ func TestCreateIssueComment(t *testing.T) {
120
120
}
121
121
testBot .issueClient = & tc
122
122
err := testBot .CreateIssueComment ("test" , testEvent )
123
- assert .NoError (t , err )
123
+ require .NoError (t , err )
124
124
})
125
125
126
126
t .Run ("create issue comment with empty body" , func (t * testing.T ) {
@@ -129,7 +129,7 @@ func TestCreateIssueComment(t *testing.T) {
129
129
}
130
130
testBot .issueClient = & tc
131
131
err := testBot .CreateIssueComment ("" , testEvent )
132
- assert .Error (t , err )
132
+ require .Error (t , err )
133
133
})
134
134
}
135
135
@@ -140,7 +140,7 @@ func TestAssignIssueToCommenter(t *testing.T) {
140
140
}
141
141
testBot .issueClient = & tc
142
142
assignee , err := testBot .AssignIssueToCommenter (testEvent )
143
- assert .Error (t , err )
143
+ require .Error (t , err )
144
144
assert .Empty (t , assignee )
145
145
})
146
146
@@ -156,7 +156,7 @@ func TestAssignIssueToCommenter(t *testing.T) {
156
156
}
157
157
testEventCopy .IssueCommentEvent .Issue .Assignees = []* github.User {}
158
158
assignee , err := testBot .AssignIssueToCommenter (testEventCopy )
159
- assert .NoError (t , err )
159
+ require .NoError (t , err )
160
160
assert .Equal (t , "testCommentLogin" , assignee )
161
161
})
162
162
@@ -170,7 +170,7 @@ func TestAssignIssueToCommenter(t *testing.T) {
170
170
}
171
171
testEventCopy .IssueCommentEvent .Issue .State = github .String ("closed" )
172
172
assignee , err := testBot .AssignIssueToCommenter (testEventCopy )
173
- assert .Error (t , err )
173
+ require .Error (t , err )
174
174
assert .Empty (t , assignee )
175
175
})
176
176
@@ -184,7 +184,7 @@ func TestAssignIssueToCommenter(t *testing.T) {
184
184
}
185
185
testEventCopy .IssueCommentEvent .Issue .Assignees = []* github.User {{Login : github .String ("testCommentLogin" )}}
186
186
assignee , err := testBot .AssignIssueToCommenter (testEventCopy )
187
- assert .Error (t , err )
187
+ require .Error (t , err )
188
188
assert .Empty (t , assignee )
189
189
})
190
190
@@ -200,7 +200,7 @@ func TestAssignIssueToCommenter(t *testing.T) {
200
200
}
201
201
testEventCopy .IssueCommentEvent .Issue .Assignees = []* github.User {{Login : github .String ("testCommentLogin2" )}}
202
202
assignee , err := testBot .AssignIssueToCommenter (testEventCopy )
203
- assert .Error (t , err )
203
+ require .Error (t , err )
204
204
assert .Empty (t , assignee )
205
205
})
206
206
}
0 commit comments