2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-30 22:05:28 +00:00

fix: tests

This commit is contained in:
Daniel
2023-06-03 00:01:44 +02:00
parent 4f44b1c400
commit 057f7b8519

View File

@@ -1855,16 +1855,19 @@ describe('TelegramBot', function telegramSuite() {
utils.handleRatelimit(bot, 'setStickerEmojiList', this);
});
it('should get the list for the given sticker of the bot sticker pack', function test() {
it('should get the list for the given sticker of the bot sticker pack', function test(done) {
const stickerPackName = `s${CURRENT_TIMESTAMP}_by_${BOT_USERNAME}`;
bot.getStickerSet(stickerPackName).then(resp => {
STICKERS_FROM_BOT_SET = resp.stickers;
assert.ok(is.array(STICKERS_FROM_BOT_SET));
});
setTimeout(() => done(), 2000);
});
it('should set a emoji list for the given sticker', function test() {
assert.ok(is.isEqual(STICKERS_FROM_BOT_SET[0].type, 'regular'));
assert.ok(is.equal(STICKERS_FROM_BOT_SET[0].type, 'regular'));
bot.setStickerEmojiList(STICKERS_FROM_BOT_SET[0].file_id, ['🥳', '😀', '😇']).then((resp) => {
assert.ok(is.boolean(resp));
@@ -1877,7 +1880,7 @@ describe('TelegramBot', function telegramSuite() {
utils.handleRatelimit(bot, 'setStickerKeywords', this);
});
it('should set a keywords list for the given sticker', function test() {
assert.ok(is.isEqual(STICKERS_FROM_BOT_SET[0].type, 'regular'));
assert.ok(is.equal(STICKERS_FROM_BOT_SET[0].type, 'regular'));
bot.setStickerKeywords(STICKERS_FROM_BOT_SET[0].file_id, { keywords: ['house', 'cat'] }).then((resp) => {
assert.ok(is.boolean(resp));
});
@@ -1895,6 +1898,19 @@ describe('TelegramBot', function telegramSuite() {
});
});
describe('#setStickerSetTitle', function setStickerSetTitleSuite() {
before(function before() {
utils.handleRatelimit(bot, 'setStickerSetTitle', this);
});
it('should set a new sticker set title', function test() {
const stickerPackName = `s${CURRENT_TIMESTAMP}_by_${BOT_USERNAME}`;
bot.setStickerSetTitle(stickerPackName, 'New title').then((resp) => {
assert.ok(is.boolean(resp));
});
});
});
describe('#setStickerSetThumbnail', function setStickerSetThumbnailSuite() {
before(function before() {
utils.handleRatelimit(bot, 'setStickerSetThumbnail', this);
@@ -1910,6 +1926,20 @@ describe('TelegramBot', function telegramSuite() {
});
});
describe.skip('#setCustomEmojiStickerSetThumbnail', function setCustomEmojiStickerSetThumbnailSuite() {
before(function before() {
utils.handleRatelimit(bot, 'setCustomEmojiStickerSetThumbnail', this);
});
it('should set a custom emoji sticjer set as thumbnail', function test() {
const stickerPackName = `s${CURRENT_TIMESTAMP}_by_${BOT_USERNAME}`;
bot.setCustomEmojiStickerSetThumbnail(stickerPackName, { custom_emoji_id: null }).then((resp) => {
assert.ok(is.boolean(resp));
});
});
});
describe.skip('#answerInlineQuery', function answerInlineQuerySuite() { });
describe.skip('#answerWebAppQuery', function answerCallbackQuerySuite() { });