From 14f37c71815827c888df1d0e627a9eaa414e7e5d Mon Sep 17 00:00:00 2001 From: GochoMugo Date: Fri, 3 Feb 2017 10:47:41 +0300 Subject: [PATCH] test: Add test for TelegramBot#sendDocument() using 'fileOpts' param References: * Original PR: https://github.com/yagop/node-telegram-bot-api/pull/152 * Original Author: @evolun --- test/telegram.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/telegram.js b/test/telegram.js index 7a5b89a..9c390dc 100644 --- a/test/telegram.js +++ b/test/telegram.js @@ -522,6 +522,13 @@ describe('TelegramBot', function telegramSuite() { assert.ok(is.object(resp.document)); }); }); + it('should send a document with custom file options', function test() { + const document = fs.createReadStream(`${__dirname}/data/photo.gif`); + const fileOpts = { filename: 'customfilename.gif' }; + return bot.sendDocument(USERID, document, {}, fileOpts).then(resp => { + assert.equal(resp.document.file_name, fileOpts.filename); + }); + }); }); describe('#sendSticker', function sendStickerSuite() {