A time driver designed to enable awesome testing and dev tooling
Thanks to the wonderful @raquelxmoss, we now support using custom equality functions.
See #19 or #20 for more detail.
E.g:
it("handles multiple events in a single frame", (done) => {
const Time = mockTimeSource();
const a = Time.diagram('---a------');
const b = Time.diagram('---b------');
const expected = Time.diagram('---(ab)---');
Time.assertEqual(xs.merge(a, b), expected);
Time.run(done);
});
.periodic()
) without using .take()
or completionit("creates a stream that emits every period ms", (done) => {
const Time = mockTimeSource();
const stream = Time.periodic(80);
const expected = Time.diagram(
`----0---1---2---`
);
Time.assertEqual(
stream,
expected
);
Time.run(done);
});
This is nice because the previous behavior was to timeout when an infinite stream was used without .take
Add support for rxjs
and most
.
For rxjs
users:
import {timeDriver, mockTimeSource} from '@cycle/time/rxjs';
For most
users:
import {timeDriver, mockTimeSource} from '@cycle/time/most';
Types specific to each stream library are included for TypeScript users.
xstream
versionAdd animationFrames
and throttleAnimation
.