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()
})
})
import {run} from "@cycle/most-run"
import DOM from "@culli/dom"
import Store, {Memory} from "@culli/store"
import Sum, {nextId} from "./Component"
const N = 100
const sliders =
Array.apply(0, Array(N)).map(() => ({id: nextId(), val: Math.floor(10 + Math.random() * 80) }))
run(Sum, {
DOM: DOM("#app"),
Store: Store(Memory({items: sliders}))
})
import Cycle from '@cycle/most-run'
import {makeDOMDriver} from '@motorcycle/dom'
import {makeGraphQLDriver, gql} from 'cycle-graphql-most-driver'
import {makeNotificationDriver} from 'cycle-notification-most-driver'
import {makeStorageDriver} from 'cycle-storage-most-driver'
import ROUTER from 'cycle-hashrouter-most-driver'
import app from './app'
Cycle.run(app, {
DOM: makeDOMDriver('#main', [
require('snabbdom/modules/props'),
require('snabbdom/modules/style')
]),
GRAPHQL: makeGraphQLDriver({
endpoint: '/graphql',
templates: {
fetchThreads: gql`
query fetchThreads {
threads {
id
messages(order: "DESC") {
text
owner {
name
}
'./widget.js',
{ DOM: sources.DOM },
['DOM'],
{
DOM: DOMMainConnector
}
).DOM).concat(sub.DOM)))
.switch()
return {
DOM: vdom$,
HTTP: sub.HTTP
};
};
run(Component, {
HTTP: makeHTTPDriver(),
DOM : makeDOMDriver('#app'),
Sandbox: makeSandboxDriver()
});
(function() {
Cycle.run(main, {
DOM: makeDOMDriver('#app-root')
});
setTimeout(() => {
function firstView(arg) {
return arg instanceof View ? arg : firstActiveView(arg);
}
function firstActiveView(state) {
return state._left.isNone() ? state.right : state._left;
}
function commitToRoot(state) {
var worker = TreeWorker.defaultPrimary().reset(state, firstActiveView(state), state.group, 2);
while(!worker.isRoot()) {
worker.ascend(2);
}
}
])
}
function main (sources: any) {
return {
DOM: sources.databases.map(mainMap)
}
}
function load (stream: Subject) {
stream.next(ENV.generateData().toArray())
Monitoring.renderRate.ping()
setTimeout(function () { load(stream) }, ENV.timeout)
}
Cycle.run(main, {
DOM: makeDOMDriver('#test-container'),
databases: function () {
const stream = subject()
load(stream)
return stream
}
})