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

Webhook health check endpoint

This commit is contained in:
Anton Mironov
2017-01-29 21:59:40 +03:00
parent 24a3f6dade
commit 3263c6c253
5 changed files with 51 additions and 15 deletions

View File

@@ -133,6 +133,12 @@ describe('TelegramBot', function telegramSuite() {
});
describe('WebHook', function webHookSuite() {
it('returns OK for healthz endpoint', function test(done) {
utils.sendWebHookRequest(webHookPort2, '/healthz', { json: false }).then(resp => {
assert.equal(resp, 'OK');
return done();
});
});
it('returns 401 error if token is wrong', function test(done) {
utils.sendWebHookMessage(webHookPort2, 'wrong-token').catch(resp => {
assert.equal(resp.statusCode, 401);