-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrandom-spec.ts
42 lines (34 loc) · 1.19 KB
/
random-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
41
42
import { marbles } from "rxjs-marbles/mocha";
import { merge } from "rxjs";
describe('Random suite ', () => {
it("should merge streams from two different markets", marbles(marble => {
const nasdaqStream = {
a: 1,
b: 3,
c: 4
};
const dowStream = {
d: 2,
e: 5,
f: 6
};
const expectedStream = {
a: 1,
b: 3,
c: 4,
d: 2,
e: 5,
f: 6
};
// this is the only reason this random test exists. Illustrating the ligning up on the strings that draws the marble diagrams in text
const nasdaq = marble.hot("^-a-b-c-|", nasdaqStream);
const dow = marble.hot("^--d----e-f|", dowStream);
const result = marble.cold("--adb-c-e-f|", expectedStream);
const nasdaqSubs = "^-------!";
const dowSubs = "^----------!";
const testStream = merge(nasdaq, dow);
marble.expect(testStream).toBeObservable(result);
marble.expect(nasdaq).toHaveSubscriptions(nasdaqSubs);
marble.expect(dow).toHaveSubscriptions(dowSubs);
}));
});