Skip to content

Commit

Permalink
Merge pull request #671 from kamikazechaser/fix/v4
Browse files Browse the repository at this point in the history
[v4.0] Add tests and add minor improvement
  • Loading branch information
yagop committed Oct 30, 2018
2 parents 11a6b22 + 6a7c088 commit 6e46f48
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/telegram.js
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ class TelegramBot extends EventEmitter {
* @see https://core.telegram.org/bots/api#editmessagemedia
*/
editMessageMedia(media, form = {}) {
form.media = media;
form.media = stringify(media);
return this._request('editMessageMedia', { form });
}

Expand Down
24 changes: 24 additions & 0 deletions test/telegram.js
Original file line number Diff line number Diff line change
Expand Up @@ -1436,4 +1436,28 @@ describe('TelegramBot', function telegramSuite() {
});
});
});

describe('#sendAnimation', function sendAnimationSuite() {
before(function before() {
utils.handleRatelimit(bot, 'sendAnimation', this);
});
it('should send a gif as an animation', function test() {
return bot.sendAnimation(USERID, `${__dirname}/data/photo.gif`).then(resp => {
assert.ok(is.object(resp));
assert.ok(is.object(resp.document));

describe('#editMessageMedia', function editMessageMediaSuite() {
before(function before() {
utils.handleRatelimit(bot, 'editMessageMedia', this);
});
it('should edit a media message', function test() {
return bot.editMessageMedia({ type: 'animation', media: resp.document.file_id, caption: 'media message edited'}, { chat_id: resp.chat.id, message_id: resp.message_id}).then(editedResp => {
assert.ok(is.object(editedResp));
assert.ok(is.string(editedResp.caption));
});
});
});
});
});
});
}); // End Telegram

0 comments on commit 6e46f48

Please sign in to comment.