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

To help you get started, we’ve selected a few @cycle/most-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 / plugins / most.ts View on Github external
{
      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()
  })
})
github goodmind / cycle-telegram / test / integration / index / most.ts View on Github external
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()
  })
})

@cycle/most-run

The Cycle run() function to be used with most.js

MIT
Latest version published 5 years ago

Package Health Score

73 / 100
Full package analysis

Popular @cycle/most-run functions