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

test: update test suite

- remove unecessary tests for node v5 and below
- fix tg side errors when running tests i.e. currency format
- enable force builds on pr
This commit is contained in:
Mohammed Sohail 2019-10-15 15:03:20 +05:30
parent a0aa87329f
commit 7feb88464d
No known key found for this signature in database
GPG Key ID: 7DD45520C01CD85D
2 changed files with 18 additions and 6 deletions

View File

@ -6,9 +6,9 @@ node_js:
- "8" - "8"
- "7" - "7"
- "6" - "6"
- "5" script:
- "4" - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash ./travis/run_on_pull_requests; fi'
# - "0.12" - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./travis/run_on_non_pull_requests; fi'
after_success: after_success:
- bash <(curl -s https://codecov.io/bash) - bash <(curl -s https://codecov.io/bash)
cache: cache:

View File

@ -1057,7 +1057,13 @@ describe('TelegramBot', function telegramSuite() {
return bot.sendLocation(USERID, lat, long, opts).then(resp => { message = resp; }); return bot.sendLocation(USERID, lat, long, opts).then(resp => { message = resp; });
}); });
it('edits live location', function test() { it('edits live location', function test() {
const opts = { chat_id: USERID, message_id: message.message_id }; const replyMarkup = JSON.stringify({
inline_keyboard: [[{
text: 'Test button',
callback_data: 'test'
}]]
});
const opts = { chat_id: USERID, message_id: message.message_id, reply_markup: replyMarkup };
return bot.editMessageLiveLocation(lat + 1, long + 1, opts).then(resp => { return bot.editMessageLiveLocation(lat + 1, long + 1, opts).then(resp => {
assert.ok(is.object(resp)); assert.ok(is.object(resp));
assert.ok(is.object(resp.location)); assert.ok(is.object(resp.location));
@ -1074,7 +1080,13 @@ describe('TelegramBot', function telegramSuite() {
return bot.sendLocation(USERID, lat, long, { live_period: 86400 }) return bot.sendLocation(USERID, lat, long, { live_period: 86400 })
.then((resp) => { .then((resp) => {
message = resp; message = resp;
const opts = { chat_id: USERID, message_id: message.message_id }; const replyMarkup = JSON.stringify({
inline_keyboard: [[{
text: 'Test button',
callback_data: 'test'
}]]
});
const opts = { chat_id: USERID, message_id: message.message_id, reply_markup: replyMarkup };
return bot.editMessageLiveLocation(lat + 1, long + 1, opts); return bot.editMessageLiveLocation(lat + 1, long + 1, opts);
}); });
}); });
@ -1367,7 +1379,7 @@ describe('TelegramBot', function telegramSuite() {
const payload = 'sku-p001'; const payload = 'sku-p001';
const providerToken = PROVIDER_TOKEN; const providerToken = PROVIDER_TOKEN;
const startParameter = 'pay'; const startParameter = 'pay';
const currency = 'KES'; const currency = 'USD';
const prices = [{ label: 'product', amount: 11000 }, { label: 'tax', amount: 11000 }]; const prices = [{ label: 'product', amount: 11000 }, { label: 'tax', amount: 11000 }];
return bot.sendInvoice(USERID, title, description, payload, providerToken, startParameter, currency, prices).then(resp => { return bot.sendInvoice(USERID, title, description, payload, providerToken, startParameter, currency, prices).then(resp => {
assert.ok(is.object(resp)); assert.ok(is.object(resp));