-
Notifications
You must be signed in to change notification settings - Fork 2
/
combine-earliest.spec.ts
40 lines (37 loc) · 1.39 KB
/
combine-earliest.spec.ts
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
import {marbles} from 'rxjs-marbles';
import {combineEarliest} from './combine-earliest';
describe('combineEarliest', () => {
it('should emit the first values from each observable', marbles(m => {
const o1 = m.cold('a----|');
const o2 = m.cold('1----|');
const o3 = m.cold('w----|');
const result = ' (abc)|';
const source = combineEarliest([o1, o2, o3]);
m.expect(source).toBeObservable(result, {
a: ['a', undefined, undefined],
b: ['a', '1', undefined],
c: ['a', '1', 'w']
});
}));
it('should emit combined values only observables', marbles(m => {
const o1 = m.cold('a-----b-----c----|');
const o2 = m.cold('--1-----2-----3--|');
const o3 = m.cold('----w-----x-----y|');
const result = ' a-b-c-d-e-f-g-h-i|';
const source = combineEarliest([o1, o2, o3]);
m.expect(source).toBeObservable(result, {
a: ['a', undefined, undefined],
b: ['a', '1', undefined],
c: ['a', '1', 'w'],
d: ['b', '1', 'w'],
e: ['b', '2', 'w'],
f: ['b', '2', 'x'],
g: ['c', '2', 'x'],
h: ['c', '3', 'x'],
i: ['c', '3', 'y']
});
}));
it('should emit an empty array', marbles(m => {
m.expect(combineEarliest([])).toBeObservable('(a|)', {a: []});
}));
});