How to use the @cycle/rx-run function in @cycle/rx-run

To help you get started, we’ve selected a few @cycle/rx-run examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github goodmind / cycle-telegram / test / integration / index / rx.ts View on Github external
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()
  })
})
github goodmind / cycle-telegram / test / integration / plugins / rx.ts View on Github external
})},
    {
      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()
  })
})

@cycle/rx-run

The Cycle run() function meant to be used with RxJS v4

MIT
Latest version published 8 years ago

Package Health Score

63 / 100
Full package analysis

Popular @cycle/rx-run functions