it('should display the default page', async () => { await request(server) .get('/') .expect(200) .expect((response) => { assert.ok(response.text.includes('Tabs VS Spaces')); }); });
describe('#sendMessage', function sendMessageSuite() { before(function before() { utils.handleRatelimit(bot, 'sendMessage', this); }); it('should send a message', function test() { return bot.sendMessage(USERID, 'test').then(resp => { assert.ok(is.object(resp)); assert.ok(is.number(resp.message_id)); }); }); });
describe.skip('#setChatAdministratorCustomTitle ', function setChatAdministratorCustomTitleSuite() { it('should set chat permissions', function test() { return bot.setChatAdministratorCustomTitle(GROUPID, USERID, 'Custom Name').then(resp => { assert.ok(is.boolean(resp)); }); }); });
describe('#getMyCommands ', function getMyCommandsSuite() { it('should get bot commands', function test() { return bot.getMyCommands().then(resp => { assert.ok(is.array(resp)); }); }); });
describe('#getWebHookInfo', function getWebHookInfoSuite() { before(function before() { utils.handleRatelimit(bot, 'getWebHookInfo', this); }); it('should return WebhookInfo', function test() { return bot.getWebHookInfo().then(resp => { assert.ok(is.object(resp)); assert.ok(is.boolean(resp.has_custom_certificate)); assert.ok(is.number(resp.pending_update_count)); }); }); });
describe('#getChatAdministrators', function getChatAdministratorsSuite() { before(function before() { utils.handleRatelimit(bot, 'getChatAdministrators', this); }); it('should return an Array', function test() { return bot.getChatAdministrators(GROUPID).then(resp => { assert.ok(Array.isArray(resp)); }); }); });
describe('#setMyCommands', function setMyCommandsSuite() { it('should set bot commands', function test() { const opts = [ { command: 'eat', description: 'Command for eat' }, { command: 'run', description: 'Command for run' } ]; return bot.setMyCommands(opts).then(resp => { assert.ok(is.boolean(resp)); }); }); });
describe('#getChatMember', function getChatMemberSuite() { before(function before() { utils.handleRatelimit(bot, 'getChatMember', this); }); it('should return a ChatMember', function test() { return bot.getChatMember(GROUPID, USERID).then(resp => { assert.ok(is.object(resp)); assert.ok(is.object(resp.user)); assert.ok(is.string(resp.status)); }); }); });
it('should handle insert error', async () => { const expectedResult = 'Invalid team specified'; await request(server) .post('/') .expect(400) .expect((response) => { assert.ok(response.text.includes(expectedResult)); }); });
describe('#getChatMembersCount', function getChatMembersCountSuite() { before(function before() { utils.handleRatelimit(bot, 'getChatMembersCount', this); }); it('should return an Integer', function test() { return bot.getChatMembersCount(GROUPID).then(resp => { assert.ok(Number.isInteger(resp)); }); }); });
describe('#getMe', function getMeSuite() { before(function before() { utils.handleRatelimit(bot, 'getMe', this); }); it('should return an User object', function test() { return bot.getMe().then(resp => { assert.ok(is.object(resp)); assert.ok(is.number(resp.id)); assert.ok(is.string(resp.first_name)); }); }); });
describe('#sendGame', function sendGameSuite() { before(function before() { utils.handleRatelimit(bot, 'sendGame', this); }); it('should send a Game', function test() { return bot.sendGame(USERID, GAME_SHORT_NAME).then(resp => { assert.ok(is.object(resp)); assert.ok(is.object(resp.game)); }); }); });
describe('#getChat', function getChatSuite() { before(function before() { utils.handleRatelimit(bot, 'getChat', this); }); it('should return a Chat object', function test() { return bot.getChat(USERID).then(resp => { assert.ok(is.object(resp)); }); }); });