From fd4cf4e3538e3c24ccb9891860b0388669e0b2da Mon Sep 17 00:00:00 2001 From: Yago Date: Sun, 3 Jan 2016 12:54:45 +0100 Subject: [PATCH] Tests cases for #56 --- test/index.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/index.js b/test/index.js index 6d1e6e6..c18dc3e 100644 --- a/test/index.js +++ b/test/index.js @@ -197,6 +197,15 @@ describe('Telegram', function () { done(); }); }); + + it('should send a photo from a Buffer', function (done) { + var bot = new Telegram(TOKEN); + var photo = fs.readFileSync(__dirname+'/bot.gif'); + bot.sendPhoto(USERID, photo).then(function (resp) { + resp.should.be.an.instanceOf(Object); + done(); + }); + }); }); describe('#sendChatAction', function () { @@ -260,6 +269,15 @@ describe('Telegram', function () { done(); }); }); + + it('should send a document from a Buffer', function (done) { + var bot = new Telegram(TOKEN); + var document = fs.readFileSync(__dirname+'/bot.gif'); + bot.sendDocument(USERID, document).then(function (resp) { + resp.should.be.an.instanceOf(Object); + done(); + }); + }); }); describe('#sendSticker', function () { @@ -300,6 +318,15 @@ describe('Telegram', function () { done(); }); }); + + it('should send a sticker from a Buffer', function (done) { + var bot = new Telegram(TOKEN); + var sticker = fs.readFileSync(__dirname+'/sticker.webp'); + bot.sendDocument(USERID, sticker).then(function (resp) { + resp.should.be.an.instanceOf(Object); + done(); + }); + }); }); describe('#sendVideo', function () {