···
167
-
describe("empty", () => {
167
+
describe("never", () => {
···
expect(nums) |> toEqual([|1, 2, 3, 4|])
228
+
testPromise("follows the spec for listenables", () => {
229
+
Wonka_thelpers.testWithListenable(Wonka.map(x => x))
230
+
|> Js.Promise.then_(x => {
232
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
233
+
|> Js.Promise.resolve
237
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
238
+
let end_: talkbackT = End;
240
+
Wonka_thelpers.testTalkbackEnd(Wonka.map(x => x))
241
+
|> Js.Promise.then_(x => {
243
+
|> toEqual(([| end_ |], [| Push(1) |]))
244
+
|> Js.Promise.resolve
describe("filter", () => {
···
expect(nums) |> toEqual([|2, 4|])
285
+
testPromise("follows the spec for listenables", () => {
286
+
Wonka_thelpers.testWithListenable(Wonka.filter((_) => true))
287
+
|> Js.Promise.then_(x => {
289
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
290
+
|> Js.Promise.resolve
294
+
testPromise("follows the spec for listenables when filtering", () => {
295
+
Wonka_thelpers.testWithListenable(Wonka.filter((_) => false))
296
+
|> Js.Promise.then_(x => {
298
+
|> toEqual(([| Pull, Pull |], [| End |]))
299
+
|> Js.Promise.resolve
303
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
304
+
let end_: talkbackT = End;
306
+
Wonka_thelpers.testTalkbackEnd(Wonka.filter((_) => true))
307
+
|> Js.Promise.then_(x => {
309
+
|> toEqual(([| end_ |], [| Push(1) |]))
310
+
|> Js.Promise.resolve
···
expect(res) |> toEqual([| Push(1), Push(3), Push(6), End |]);
353
+
testPromise("follows the spec for listenables", () => {
354
+
Wonka_thelpers.testWithListenable(Wonka.scan((_, x) => x, 0))
355
+
|> Js.Promise.then_(x => {
357
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
358
+
|> Js.Promise.resolve
362
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
363
+
let end_: talkbackT = End;
365
+
Wonka_thelpers.testTalkbackEnd(Wonka.scan((_, x) => x, 0))
366
+
|> Js.Promise.then_(x => {
368
+
|> toEqual(([| end_ |], [| Push(1) |]))
369
+
|> Js.Promise.resolve
describe("merge", () => {
···
expect(signals) == [| Push(1), Push(4), Push(5), Push(6), Push(2), Push(3), End |];
402
+
testPromise("follows the spec for listenables", () => {
403
+
Wonka_thelpers.testWithListenable(source => Wonka.merge([|source|]))
404
+
|> Js.Promise.then_(x => {
406
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
407
+
|> Js.Promise.resolve
411
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
412
+
let end_: talkbackT = End;
414
+
Wonka_thelpers.testTalkbackEnd(source => Wonka.merge([|source|]))
415
+
|> Js.Promise.then_(x => {
417
+
|> toEqual(([| end_ |], [| Push(1) |]))
418
+
|> Js.Promise.resolve
describe("concat", () => {
···
expect(signals) == [| Push(1), Push(2), Push(3), Push(4), Push(5), Push(6), End |];
451
+
testPromise("follows the spec for listenables", () => {
452
+
Wonka_thelpers.testWithListenable(source => Wonka.concat([|source|]))
453
+
|> Js.Promise.then_(x => {
455
+
|> toEqual(([| Pull |], [| Push(1), Push(2), End |]))
456
+
|> Js.Promise.resolve
460
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
461
+
let end_: talkbackT = End;
463
+
Wonka_thelpers.testTalkbackEnd(source => Wonka.concat([|source|]))
464
+
|> Js.Promise.then_(x => {
466
+
|> toEqual(([| Pull, end_ |], [| Push(1) |]))
467
+
|> Js.Promise.resolve
···
expect((numsA, nums)) |> toEqual(([| Push(1), Push(1), Push(1) |], [| Push(1), Push(1), Push(1), Push(2), Push(2), End, End |]));
530
+
testPromise("follows the spec for listenables", () => {
531
+
Wonka_thelpers.testWithListenable(Wonka.share)
532
+
|> Js.Promise.then_(x => {
534
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
535
+
|> Js.Promise.resolve
539
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
540
+
let end_: talkbackT = End;
542
+
Wonka_thelpers.testTalkbackEnd(Wonka.share)
543
+
|> Js.Promise.then_(x => {
545
+
|> toEqual(([| end_ |], [| Push(1) |]))
546
+
|> Js.Promise.resolve
describe("combine", () => {
···
expect(res) |> toEqual([| Push((1, 2)), Push((2, 2)), Push((2, 4)), End |]);
597
+
testPromise("follows the spec for listenables", () => {
598
+
Wonka_thelpers.testWithListenable(source => {
599
+
let shared = Wonka.share(source);
600
+
Wonka.combine(shared, shared)
602
+
|> Js.Promise.then_(x => {
604
+
|> toEqual(([||], [| Push((1, 1)), Push((2, 1)), Push((2, 2)), End |]))
605
+
|> Js.Promise.resolve
609
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
610
+
let end_: talkbackT = End;
612
+
Wonka_thelpers.testTalkbackEnd(source => {
613
+
let shared = Wonka.share(source);
614
+
Wonka.combine(shared, shared)
616
+
|> Js.Promise.then_(x => {
618
+
|> toEqual(([| end_ |], [| Push((1, 1)) |]))
619
+
|> Js.Promise.resolve
···
expect(res) |> toEqual([| Push(1), End |]);
692
+
testPromise("follows the spec for listenables", () => {
693
+
Wonka_thelpers.testWithListenable(Wonka.take(10))
694
+
|> Js.Promise.then_(x => {
696
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
697
+
|> Js.Promise.resolve
701
+
testPromise("follows the spec for listenables when ending the source", () => {
702
+
let end_: talkbackT = End;
704
+
Wonka_thelpers.testWithListenable(Wonka.take(1))
705
+
|> Js.Promise.then_(x => {
707
+
|> toEqual(([| end_ |], [| Push(1), End |]))
708
+
|> Js.Promise.resolve
712
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
713
+
let end_: talkbackT = End;
715
+
Wonka_thelpers.testTalkbackEnd(Wonka.take(10))
716
+
|> Js.Promise.then_(x => {
718
+
|> toEqual(([| end_ |], [| Push(1) |]))
719
+
|> Js.Promise.resolve
describe("takeLast", () => {
···
expect(res) |> toEqual([| Push(3), Push(4), End |]);
758
+
testPromise("follows the spec for listenables", () => {
759
+
Wonka_thelpers.testWithListenable(Wonka.takeLast(10))
760
+
|> Js.Promise.then_(x => {
762
+
|> toEqual(([| Pull, Pull, Pull |], [| /* empty since the source is a pullable */ |]))
763
+
|> Js.Promise.resolve
767
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
768
+
Wonka_thelpers.testTalkbackEnd(Wonka.takeLast(10))
769
+
|> Js.Promise.then_(x => {
771
+
|> toEqual(([| Pull, Pull |], [| |]))
772
+
|> Js.Promise.resolve
describe("takeWhile", () => {
···
expect(res) |> toEqual([| Push(1), End |]);
847
+
testPromise("follows the spec for listenables", () => {
848
+
Wonka_thelpers.testWithListenable(Wonka.takeWhile((_) => true))
849
+
|> Js.Promise.then_(x => {
851
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
852
+
|> Js.Promise.resolve
856
+
testPromise("follows the spec for listenables when ending the source", () => {
857
+
let end_: talkbackT = End;
859
+
Wonka_thelpers.testWithListenable(Wonka.takeWhile((_) => false))
860
+
|> Js.Promise.then_(x => {
862
+
|> toEqual(([| end_ |], [| End |]))
863
+
|> Js.Promise.resolve
867
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
868
+
let end_: talkbackT = End;
870
+
Wonka_thelpers.testTalkbackEnd(Wonka.takeWhile((_) => true))
871
+
|> Js.Promise.then_(x => {
873
+
|> toEqual(([| end_ |], [| Push(1) |]))
874
+
|> Js.Promise.resolve
describe("takeUntil", () => {
···
expect(res) |> toEqual([| Push(1), Push(2), End |]);
962
+
testPromise("follows the spec for listenables", () => {
963
+
Wonka_thelpers.testWithListenable(Wonka.takeUntil(Wonka.never))
964
+
|> Js.Promise.then_(x => {
966
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
967
+
|> Js.Promise.resolve
971
+
testPromise("follows the spec for listenables when ending the source", () => {
972
+
let end_: talkbackT = End;
974
+
Wonka_thelpers.testWithListenable(Wonka.takeUntil(Wonka.fromValue(0)))
975
+
|> Js.Promise.then_(x => {
977
+
|> toEqual(([| end_ |], [| End |]))
978
+
|> Js.Promise.resolve
982
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
983
+
let end_: talkbackT = End;
985
+
Wonka_thelpers.testTalkbackEnd(Wonka.takeUntil(Wonka.never))
986
+
|> Js.Promise.then_(x => {
988
+
|> toEqual(([| end_ |], [| Push(1) |]))
989
+
|> Js.Promise.resolve
···
expect(res) |> toEqual([| Push(3), Push(4), End |]);
1028
+
testPromise("follows the spec for listenables", () => {
1029
+
Wonka_thelpers.testWithListenable(Wonka.skip(0))
1030
+
|> Js.Promise.then_(x => {
1032
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
1033
+
|> Js.Promise.resolve
1037
+
testPromise("follows the spec for listenables when skipping the source", () => {
1038
+
Wonka_thelpers.testWithListenable(Wonka.skip(10))
1039
+
|> Js.Promise.then_(x => {
1041
+
|> toEqual(([| Pull, Pull |], [| End |]))
1042
+
|> Js.Promise.resolve
1046
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
1047
+
let end_: talkbackT = End;
1049
+
Wonka_thelpers.testTalkbackEnd(Wonka.skip(10))
1050
+
|> Js.Promise.then_(x => {
1052
+
|> toEqual(([| Pull, end_ |], [| |]))
1053
+
|> Js.Promise.resolve
describe("skipWhile", () => {
···
expect(res) |> toEqual([| Push(3), Push(4), End |]);
1092
+
testPromise("follows the spec for listenables", () => {
1093
+
Wonka_thelpers.testWithListenable(Wonka.skipWhile((_) => false))
1094
+
|> Js.Promise.then_(x => {
1096
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
1097
+
|> Js.Promise.resolve
1101
+
testPromise("follows the spec for listenables when skipping the source", () => {
1102
+
Wonka_thelpers.testWithListenable(Wonka.skipWhile((_) => true))
1103
+
|> Js.Promise.then_(x => {
1105
+
|> toEqual(([| Pull, Pull |], [| End |]))
1106
+
|> Js.Promise.resolve
1110
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
1111
+
let end_: talkbackT = End;
1113
+
Wonka_thelpers.testTalkbackEnd(Wonka.skipWhile((_) => false))
1114
+
|> Js.Promise.then_(x => {
1116
+
|> toEqual(([| end_ |], [| Push(1) |]))
1117
+
|> Js.Promise.resolve
describe("skipUntil", () => {
···
expect(res) |> toEqual([| End |]);
1205
+
testPromise("follows the spec for listenables", () => {
1206
+
Wonka_thelpers.testWithListenable(Wonka.skipUntil(Wonka.never))
1207
+
|> Js.Promise.then_(x => {
1209
+
|> toEqual(([| Pull, Pull, Pull |], [| End |]))
1210
+
|> Js.Promise.resolve
1214
+
testPromise("follows the spec for listenables when skipping the source", () => {
1215
+
Wonka_thelpers.testWithListenable(Wonka.skipUntil(Wonka.fromValue(0)))
1216
+
|> Js.Promise.then_(x => {
1218
+
|> toEqual(([| Pull |], [| Push(1), Push(2), End |]))
1219
+
|> Js.Promise.resolve
1223
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
1224
+
let end_: talkbackT = End;
1226
+
Wonka_thelpers.testTalkbackEnd(Wonka.skipUntil(Wonka.fromValue(0)))
1227
+
|> Js.Promise.then_(x => {
1229
+
|> toEqual(([| Pull, end_ |], [| Push(1) |]))
1230
+
|> Js.Promise.resolve