mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-30 05:48:00 +00:00
Add SendDocument Test
Add SendDocument Test
This commit is contained in:
parent
c2d4ec145a
commit
16b9d2b695
@ -203,3 +203,45 @@ describe('Telegram', function () {
|
|||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
describe('#sendDocument', function () {
|
||||||
|
var documentId;
|
||||||
|
it('should send a document from file', function (done) {
|
||||||
|
var bot = new Telegram(TOKEN);
|
||||||
|
var document = __dirname+'/bot.gif';
|
||||||
|
bot.sendDocument(USERID, document).then(function (resp) {
|
||||||
|
resp.should.be.an.instanceOf(Object);
|
||||||
|
documentId = resp.document.file_id;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should send a photo from id', function (done) {
|
||||||
|
var bot = new Telegram(TOKEN);
|
||||||
|
// Send the same photo as before
|
||||||
|
var document = documentId;
|
||||||
|
bot.sendPhoto(USERID, document).then(function (resp) {
|
||||||
|
resp.should.be.an.instanceOf(Object);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should send a photo from fs.readStream', function (done) {
|
||||||
|
var bot = new Telegram(TOKEN);
|
||||||
|
var document = fs.createReadStream(__dirname+'/bot.gif');
|
||||||
|
bot.sendDocument(USERID, document).then(function (resp) {
|
||||||
|
resp.should.be.an.instanceOf(Object);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should send a document from request Stream', function (done) {
|
||||||
|
var bot = new Telegram(TOKEN);
|
||||||
|
var document = request('https://telegram.org/img/t_logo.png');
|
||||||
|
bot.sendDocument(USERID, document).then(function (resp) {
|
||||||
|
resp.should.be.an.instanceOf(Object);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user