This repository was archived by the owner on Dec 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathtest-with-rxjs.js
More file actions
80 lines (68 loc) · 1.73 KB
/
test-with-rxjs.js
File metadata and controls
80 lines (68 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import test from 'ava';
import {Observable} from 'rxjs';
import {run} from '@cycle/rxjs-run';
import onionify, {makeCollection} from './lib/index';
test('StateSource.state$ should be an Observable', t => {
t.plan(1);
function main(sources) {
t.is(typeof sources.onion.state$.switchMap, 'function');
return {
onion: Observable.never(),
};
}
run(onionify(main), {dummy: () => {}});
});
test('StateSource.select(s).state$ should be an Observable', t => {
t.plan(1);
function main(sources) {
t.is(typeof sources.onion.select('foo').state$.switchMap, 'function');
return {
onion: Observable.never(),
};
}
run(onionify(main), {dummy: () => {}});
});
test('makeCollection pickCombine sinks should be Observables', t => {
t.plan(1);
function child(sources) {
return {
onion: Observable.never(),
};
}
function main(sources) {
const List = makeCollection({
item: child,
collectSinks: instances => ({
onion: instances.pickCombine('onion')
}),
});
const obs = List(sources).onion;
t.is(typeof obs.switchMap, 'function');
return {
onion: Observable.never(),
};
}
run(onionify(main), {dummy: () => {}});
});
test('makeCollection pickMerge sinks should be Observables', t => {
t.plan(1);
function child(sources) {
return {
onion: Observable.never(),
};
}
function main(sources) {
const List = makeCollection({
item: child,
collectSinks: instances => ({
onion: instances.pickMerge('onion')
}),
});
const obs = List(sources).onion;
t.is(typeof obs.switchMap, 'function');
return {
onion: Observable.never(),
};
}
run(onionify(main), {dummy: () => {}});
});