2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-31 06:16:07 +00:00

src/telegram: Deprecate auto-enabling Promise cancellation

Side-effects:

  src/telegram: Allow providing custom Promise constructor

References:

  * BR: https://github.com/yagop/node-telegram-bot-api/issues/319
This commit is contained in:
GochoMugo
2017-08-25 18:39:13 +03:00
parent 28160c70cd
commit ef48af49f5
3 changed files with 126 additions and 67 deletions

View File

@@ -109,6 +109,15 @@ describe('TelegramBot', function telegramSuite() {
});
});
it('allows providing custom Promise library', function test() {
TelegramBot.Promise = global.Promise;
const promise = bot.stopPolling();
assert.ok(promise instanceof global.Promise);
assert.ok(!(promise instanceof Promise));
// revert
TelegramBot.Promise = Promise;
});
it('automatically starts polling', function test() {
assert.equal(botPolling.isPolling(), true);
return utils.isPollingMockServer(pollingPort2);