Skip to content

Commit

Permalink
Add error case to TestKickTroll
Browse files Browse the repository at this point in the history
  • Loading branch information
ryukinix committed Jul 28, 2020
1 parent 641d00c commit 1398ef0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion troll_shield_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ func (bot *BotMockup) GetChatMember(c telegram.ChatConfigWithUser) (telegram.Cha
}

func (bot *BotMockup) KickChatMember(c telegram.KickChatMemberConfig) (telegram.APIResponse, error) {
return telegram.APIResponse{Ok: true}, nil
switch c.ChatMemberConfig.UserID {
case 0:
return telegram.APIResponse{Ok: true}, nil
default:
return telegram.APIResponse{Ok: false}, errors.New("error")
}

}

func (bot *BotMockup) Send(c telegram.Chattable) (telegram.Message, error) {
Expand Down Expand Up @@ -137,6 +143,8 @@ func TestKickTroll(t *testing.T) {
update.Message = &message
user := telegram.User{}
kickTroll(&botnilson, &update, user, "@trollhouse")
user.ID = 1
kickTroll(&botnilson, &update, user, "@trollhouse")
}

func TestWelcomeMessage(t *testing.T) {
Expand Down

0 comments on commit 1398ef0

Please sign in to comment.