Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('should kick chat member with basic driver', t => {
let basicDriver = makeTelegramDriver(ACCESS_TOKEN, { skipUpdates: true })
let main = () => ({
bot: $.from([
$.just(kickChatMember(
{ chat_id: SUPERGROUP_ID, user_id: 115000496 },
{}))
])
})
let { sources, run } = Cycle(main, { bot: basicDriver })
run()
okTake(t, sources, (bool) => {
t.equal(bool, true, 'bool should be true')
t.end()
})
})
})},
{
type: Update,
name: 'not-found',
component: ({ props }) => {
t.fail(`wrong command \`${props[0]}\``)
}}
]
let main = (s: Sources) => ({
bot: $.from([
matchStream(s.bot.events('message').filter(entityIs('bot_command')), plugins, s)
.pluck('bot')
.mergeAll()
])
})
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()
})
})