Skip to content

Commit

Permalink
test(reply-menu-middleware): async func has to be awaited
Browse files Browse the repository at this point in the history
  • Loading branch information
EdJoPaTo committed Apr 7, 2019
1 parent 9d95e04 commit 7d987a3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/reply-menu-middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,17 @@ test('fails in dynamic menu without specific ActionCode', async t => {
await bot.handleUpdate({message: {text: '42'}} as Update)
})

test('fails before init', t => {
test('fails before init', async t => {
const menu = new TelegrafInlineMenu('foo')
const submenu = new TelegrafInlineMenu('bar')
menu.selectSubmenu('b', ['y', 'z'], submenu)

const replyMenuMiddleware = submenu.replyMenuMiddleware()
const handler = replyMenuMiddleware.middleware()
t.throws(() => {
handler({} as ContextMessageUpdate, () => null)
}, /menu.init/)
await t.throwsAsync(
async () => handler({} as ContextMessageUpdate, () => null),
/menu.init/
)
})

test('does not work with menu on multiple positions', t => {
Expand Down

0 comments on commit 7d987a3

Please sign in to comment.