Skip to content

Commit 1398ef0

Browse files
committed
Add error case to TestKickTroll
1 parent 641d00c commit 1398ef0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

troll_shield_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@ func (bot *BotMockup) GetChatMember(c telegram.ChatConfigWithUser) (telegram.Cha
2626
}
2727

2828
func (bot *BotMockup) KickChatMember(c telegram.KickChatMemberConfig) (telegram.APIResponse, error) {
29-
return telegram.APIResponse{Ok: true}, nil
29+
switch c.ChatMemberConfig.UserID {
30+
case 0:
31+
return telegram.APIResponse{Ok: true}, nil
32+
default:
33+
return telegram.APIResponse{Ok: false}, errors.New("error")
34+
}
35+
3036
}
3137

3238
func (bot *BotMockup) Send(c telegram.Chattable) (telegram.Message, error) {
@@ -137,6 +143,8 @@ func TestKickTroll(t *testing.T) {
137143
update.Message = &message
138144
user := telegram.User{}
139145
kickTroll(&botnilson, &update, user, "@trollhouse")
146+
user.ID = 1
147+
kickTroll(&botnilson, &update, user, "@trollhouse")
140148
}
141149

142150
func TestWelcomeMessage(t *testing.T) {

0 commit comments

Comments
 (0)