Skip to content

Commit

Permalink
tests: add Notify and Delete calls
Browse files Browse the repository at this point in the history
  • Loading branch information
demget committed May 6, 2020
1 parent 7324790 commit 772f07c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions bot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ func TestBotProcessUpdate(t *testing.T) {
b.Handle(OnAudio, func(m *Message) {
assert.NotNil(t, m.Audio)
})
b.Handle(OnAnimation, func(m *Message) {
assert.NotNil(t, m.Animation)
})
b.Handle(OnDocument, func(m *Message) {
assert.NotNil(t, m.Document)
})
Expand Down Expand Up @@ -244,6 +247,7 @@ func TestBotProcessUpdate(t *testing.T) {
b.ProcessUpdate(Update{Message: &Message{Photo: &Photo{}}})
b.ProcessUpdate(Update{Message: &Message{Voice: &Voice{}}})
b.ProcessUpdate(Update{Message: &Message{Audio: &Audio{}}})
b.ProcessUpdate(Update{Message: &Message{Animation: &Animation{}}})
b.ProcessUpdate(Update{Message: &Message{Document: &Document{}}})
b.ProcessUpdate(Update{Message: &Message{Sticker: &Sticker{}}})
b.ProcessUpdate(Update{Message: &Message{Video: &Video{}}})
Expand Down Expand Up @@ -302,6 +306,10 @@ func TestBot(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, msg.Photo)
assert.Equal(t, photo.Caption, msg.Caption)

msg, err = b.EditCaption(msg, "new caption")
assert.NoError(t, err)
assert.Equal(t, "new caption", msg.Caption)
})

var msg *Message
Expand Down Expand Up @@ -375,6 +383,16 @@ func TestBot(t *testing.T) {
assert.Equal(t, ErrButtonDataInvalid, err)
})

t.Run("Notify()", func(t *testing.T) {
assert.Equal(t, ErrBadRecipient, b.Notify(nil, Typing))
assert.NoError(t, b.Notify(to, Typing))
})

// should be the last
t.Run("Delete()", func(t *testing.T) {
assert.NoError(t, b.Delete(msg))
})

t.Run("Commands", func(t *testing.T) {
orig := []Command{{
Text: "test",
Expand Down

0 comments on commit 772f07c

Please sign in to comment.