Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('reverts changes if an agenda fails', t => {
const dispatcher = createDispatcher()
dispatcher
.reduce(AdderStore)
.bufferCount(4)
.subscribe(x => {
t.same(x, [ 0, 1, 2, 0 ])
}, err => {
t.fail()
}, () => {
t.end()
})
dispatcher.schedule(Observable
.interval(200)
.take(2)
.map(() => add)
.concat(Observable.throw()))
})
.subscribe(([ x, y ]) => {
t.same(x, [ 0, 1, 2, 0 ])
t.same(y, [ 0, -1, -2, -3, -4, -5 ])
}, err => {
t.fail()
}, () => {
t.end()
})
dispatcher.schedule(Observable
.interval(250)
.take(2)
.map(() => add)
.concat(Observable.throw()))
dispatcher.schedule(Observable
.interval(100)
.take(5)
.map(() => subtract))
})
.reduce(AdderStore)
.bufferCount(4),
dispatcher
.reduce(SubtractorStore)
.bufferCount(6)
])
.subscribe(([ x, y ]) => {
t.same(x, [ 0, 1, 2, 0 ])
t.same(y, [ 0, -1, -2, -3, -4, -5 ])
}, err => {
t.fail()
}, () => {
t.end()
})
dispatcher.schedule(Observable
.interval(250)
.take(2)
.map(() => add)
.concat(Observable.throw()))
dispatcher.schedule(Observable
.interval(100)
.take(5)
.map(() => subtract))
})
componentDidMount() {
if (this.props.photoUrls && this.props.photoUrls.length > 1) {
this.imageToggle = Observable.interval(2000)
.take(this.props.photoUrls.length)
.repeat(this.props.repeatCount)
.subscribe((x) => {
this.setState({
photoUrl: this.props.photoUrls[x]
});
});
}
}