Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{
type: Update,
name: 'not-found',
component: ({ props }) => {
t.fail(`wrong command \`${props[0]}\``)
}
}
]
let main = (s: Sources) => ({
bot: most.from([
matchStream(s.bot.events('message').filter(entityIs('bot_command')), plugins, s)
.map((x: Sources) => x.bot)
.join()
])
})
let { sources, run } = Cycle(main, { bot: basicDriver })
run()
okTake(t, sources, (message) => {
t.ok(Message.is(Message(message)), 'message satisfies typecheck')
t.ok(
/\/(help)(?:@goodmind_test_bot)?(\s+(.+))?/.test(message.reply_to_message.text),
'reply to message text should match `/help` command pattern')
t.equal(
message.text,
'Cycle Telegram v1.1.1 (https://git.io/vrs3P)',
'message text should be equal to `Cycle Telegram v1.1.1 (https://git.io/vrs3P)`')
t.end()
})
})
test('should get chat with basic driver', t => {
let basicDriver = makeTelegramDriver(ACCESS_TOKEN, { skipUpdates: true })
let main = () => ({
bot: most.from([
most.of(getChat({ chat_id: GROUP_ID }, {}))
])
})
let { sources, run } = Cycle(main, { bot: basicDriver })
run()
okTake(t, sources, (chat) => {
t.ok(Chat.is(Chat(chat)), 'chat satisfies typecheck')
t.equal(chat.id, GROUP_ID)
t.end()
})
})