mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-31 14:25:57 +00:00
[telegram] Return error on trying to use Polling, WebHook together
Feature: Polling and WebHook are mutually exclusive. Therefore, return an error whenever the user tries to start polling, and the instance has an open webhook, or user tries to open a webhook, and the instance is already polling.
This commit is contained in:
@@ -185,6 +185,12 @@ describe('TelegramBot', function telegramSuite() {
|
||||
return utils.isPollingMockServer(pollingPort);
|
||||
});
|
||||
});
|
||||
it('returns error if using webhook', function test() {
|
||||
return botWebHook.startPolling().catch((err) => {
|
||||
// TODO: check for error in a better way
|
||||
assert.ok(err.message.indexOf('mutually exclusive') !== -1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('#isPolling', function isPollingSuite() {
|
||||
@@ -219,6 +225,12 @@ describe('TelegramBot', function telegramSuite() {
|
||||
return utils.hasOpenWebHook(webHookPort);
|
||||
});
|
||||
});
|
||||
it('returns error if using polling', function test() {
|
||||
return botPolling.openWebHook().catch((err) => {
|
||||
// TODO: check for error in a better way
|
||||
assert.ok(err.message.indexOf('mutually exclusive') !== -1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('#hasOpenWebHook', function hasOpenWebHookSuite() {
|
||||
|
Reference in New Issue
Block a user