2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-29 13:27:44 +00:00

Check if test are running in CI and skip invoice if so

This commit is contained in:
Yago 2017-07-05 23:47:05 +02:00
parent e1f8fb25ec
commit 0bf148adb9
2 changed files with 7 additions and 3 deletions

View File

@ -57,6 +57,7 @@
"eslint-config-airbnb": "^6.2.0", "eslint-config-airbnb": "^6.2.0",
"eslint-plugin-mocha": "^4.8.0", "eslint-plugin-mocha": "^4.8.0",
"is": "^3.1.0", "is": "^3.1.0",
"is-ci": "^1.0.10",
"istanbul": "^1.1.0-alpha.1", "istanbul": "^1.1.0-alpha.1",
"jsdoc-to-markdown": "^2.0.1", "jsdoc-to-markdown": "^2.0.1",
"mocha": "^3.2.0", "mocha": "^3.2.0",

View File

@ -7,17 +7,18 @@ const os = require('os');
const path = require('path'); const path = require('path');
const is = require('is'); const is = require('is');
const utils = require('./utils'); const utils = require('./utils');
const isCI = require('is-ci');
// Allows self-signed certificates to be used in our tests // Allows self-signed certificates to be used in our tests
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
const TOKEN = process.env.TEST_TELEGRAM_TOKEN; const TOKEN = process.env.TEST_TELEGRAM_TOKEN;
if (!TOKEN) { if (!TOKEN)
throw new Error('Bot token not provided'); throw new Error('Bot token not provided');
} }
const PROVIDER_TOKEN = process.env.TEST_PROVIDER_TOKEN; const PROVIDER_TOKEN = process.env.TEST_PROVIDER_TOKEN;
if (!PROVIDER_TOKEN) { if (!PROVIDER_TOKEN && !isCI) { // If is not running in Travis / Appveyor
throw new Error('Provider token not supplied'); throw new Error('Provider token not supplied');
} }
@ -1324,7 +1325,9 @@ describe('TelegramBot', function telegramSuite() {
utils.handleRatelimit(bot, 'sendInvoice', this); utils.handleRatelimit(bot, 'sendInvoice', this);
}); });
it('should send an invoice', function test() { it('should send an invoice', function test() {
this.skip(); // Skip test for now if (isCI) {
this.skip(); // Skip test for now
}
const title = 'Demo product'; const title = 'Demo product';
const description = 'our test product'; const description = 'our test product';
const payload = 'sku-p001'; const payload = 'sku-p001';