mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-31 22:35:38 +00:00
[webhook,polling] Improve starting, stopping of webhook, polling
Feature: The different mechanisms of fetching updates, i.e. polling and webhook, have had their implementations improved: * the TelegramBot instance needs to create the polling and webhook instances once, and when necessary * returning promises from TelegramBot#openWebHook() and TelegramBot#startPolling() allows more precise control Also, * TelegramBot#initPolling() is being deprecated in favor of TelegramBot#startPolling() to ensure consistency (as the opposite action of TelegramBot#stopPolling())
This commit is contained in:
@@ -178,10 +178,11 @@ describe('TelegramBot', function telegramSuite() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('#initPolling', function initPollingSuite() {
|
||||
describe('#startPolling', function initPollingSuite() {
|
||||
it('initiates polling', function test() {
|
||||
testbot.initPolling();
|
||||
return utils.isPollingMockServer(pollingPort);
|
||||
return testbot.startPolling().then(() => {
|
||||
return utils.isPollingMockServer(pollingPort);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -213,8 +214,9 @@ describe('TelegramBot', function telegramSuite() {
|
||||
|
||||
describe('#openWebHook', function openWebHookSuite() {
|
||||
it('opens webhook', function test() {
|
||||
testbot.openWebHook();
|
||||
return utils.hasOpenWebHook(webHookPort);
|
||||
return testbot.openWebHook().then(() => {
|
||||
return utils.hasOpenWebHook(webHookPort);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user