···
+
describe("never", () => {
···
expect(nums) |> toEqual([|1, 2, 3, 4|])
+
testPromise("follows the spec for listenables", () => {
+
Wonka_thelpers.testWithListenable(Wonka.map(x => x))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
+
let end_: talkbackT = End;
+
Wonka_thelpers.testTalkbackEnd(Wonka.map(x => x))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| end_ |], [| Push(1) |]))
describe("filter", () => {
···
expect(nums) |> toEqual([|2, 4|])
+
testPromise("follows the spec for listenables", () => {
+
Wonka_thelpers.testWithListenable(Wonka.filter((_) => true))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
+
testPromise("follows the spec for listenables when filtering", () => {
+
Wonka_thelpers.testWithListenable(Wonka.filter((_) => false))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| Pull, Pull |], [| End |]))
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
+
let end_: talkbackT = End;
+
Wonka_thelpers.testTalkbackEnd(Wonka.filter((_) => true))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| end_ |], [| Push(1) |]))
···
expect(res) |> toEqual([| Push(1), Push(3), Push(6), End |]);
+
testPromise("follows the spec for listenables", () => {
+
Wonka_thelpers.testWithListenable(Wonka.scan((_, x) => x, 0))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
+
let end_: talkbackT = End;
+
Wonka_thelpers.testTalkbackEnd(Wonka.scan((_, x) => x, 0))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| end_ |], [| Push(1) |]))
describe("merge", () => {
···
expect(signals) == [| Push(1), Push(4), Push(5), Push(6), Push(2), Push(3), End |];
+
testPromise("follows the spec for listenables", () => {
+
Wonka_thelpers.testWithListenable(source => Wonka.merge([|source|]))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
+
let end_: talkbackT = End;
+
Wonka_thelpers.testTalkbackEnd(source => Wonka.merge([|source|]))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| end_ |], [| Push(1) |]))
describe("concat", () => {
···
expect(signals) == [| Push(1), Push(2), Push(3), Push(4), Push(5), Push(6), End |];
+
testPromise("follows the spec for listenables", () => {
+
Wonka_thelpers.testWithListenable(source => Wonka.concat([|source|]))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| Pull |], [| Push(1), Push(2), End |]))
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
+
let end_: talkbackT = End;
+
Wonka_thelpers.testTalkbackEnd(source => Wonka.concat([|source|]))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| Pull, end_ |], [| Push(1) |]))
···
expect((numsA, nums)) |> toEqual(([| Push(1), Push(1), Push(1) |], [| Push(1), Push(1), Push(1), Push(2), Push(2), End, End |]));
+
testPromise("follows the spec for listenables", () => {
+
Wonka_thelpers.testWithListenable(Wonka.share)
+
|> Js.Promise.then_(x => {
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
+
let end_: talkbackT = End;
+
Wonka_thelpers.testTalkbackEnd(Wonka.share)
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| end_ |], [| Push(1) |]))
describe("combine", () => {
···
expect(res) |> toEqual([| Push((1, 2)), Push((2, 2)), Push((2, 4)), End |]);
+
testPromise("follows the spec for listenables", () => {
+
Wonka_thelpers.testWithListenable(source => {
+
let shared = Wonka.share(source);
+
Wonka.combine(shared, shared)
+
|> Js.Promise.then_(x => {
+
|> toEqual(([||], [| Push((1, 1)), Push((2, 1)), Push((2, 2)), End |]))
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
+
let end_: talkbackT = End;
+
Wonka_thelpers.testTalkbackEnd(source => {
+
let shared = Wonka.share(source);
+
Wonka.combine(shared, shared)
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| end_ |], [| Push((1, 1)) |]))
···
expect(res) |> toEqual([| Push(1), End |]);
+
testPromise("follows the spec for listenables", () => {
+
Wonka_thelpers.testWithListenable(Wonka.take(10))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
+
testPromise("follows the spec for listenables when ending the source", () => {
+
let end_: talkbackT = End;
+
Wonka_thelpers.testWithListenable(Wonka.take(1))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| end_ |], [| Push(1), End |]))
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
+
let end_: talkbackT = End;
+
Wonka_thelpers.testTalkbackEnd(Wonka.take(10))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| end_ |], [| Push(1) |]))
describe("takeLast", () => {
···
expect(res) |> toEqual([| Push(3), Push(4), End |]);
+
testPromise("follows the spec for listenables", () => {
+
Wonka_thelpers.testWithListenable(Wonka.takeLast(10))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| Pull, Pull, Pull |], [| /* empty since the source is a pullable */ |]))
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
+
Wonka_thelpers.testTalkbackEnd(Wonka.takeLast(10))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| Pull, Pull |], [| |]))
describe("takeWhile", () => {
···
expect(res) |> toEqual([| Push(1), End |]);
+
testPromise("follows the spec for listenables", () => {
+
Wonka_thelpers.testWithListenable(Wonka.takeWhile((_) => true))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
+
testPromise("follows the spec for listenables when ending the source", () => {
+
let end_: talkbackT = End;
+
Wonka_thelpers.testWithListenable(Wonka.takeWhile((_) => false))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| end_ |], [| End |]))
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
+
let end_: talkbackT = End;
+
Wonka_thelpers.testTalkbackEnd(Wonka.takeWhile((_) => true))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| end_ |], [| Push(1) |]))
describe("takeUntil", () => {
···
expect(res) |> toEqual([| Push(1), Push(2), End |]);
+
testPromise("follows the spec for listenables", () => {
+
Wonka_thelpers.testWithListenable(Wonka.takeUntil(Wonka.never))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
+
testPromise("follows the spec for listenables when ending the source", () => {
+
let end_: talkbackT = End;
+
Wonka_thelpers.testWithListenable(Wonka.takeUntil(Wonka.fromValue(0)))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| end_ |], [| End |]))
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
+
let end_: talkbackT = End;
+
Wonka_thelpers.testTalkbackEnd(Wonka.takeUntil(Wonka.never))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| end_ |], [| Push(1) |]))
···
expect(res) |> toEqual([| Push(3), Push(4), End |]);
+
testPromise("follows the spec for listenables", () => {
+
Wonka_thelpers.testWithListenable(Wonka.skip(0))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
+
testPromise("follows the spec for listenables when skipping the source", () => {
+
Wonka_thelpers.testWithListenable(Wonka.skip(10))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| Pull, Pull |], [| End |]))
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
+
let end_: talkbackT = End;
+
Wonka_thelpers.testTalkbackEnd(Wonka.skip(10))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| Pull, end_ |], [| |]))
describe("skipWhile", () => {
···
expect(res) |> toEqual([| Push(3), Push(4), End |]);
+
testPromise("follows the spec for listenables", () => {
+
Wonka_thelpers.testWithListenable(Wonka.skipWhile((_) => false))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([||], [| Push(1), Push(2), End |]))
+
testPromise("follows the spec for listenables when skipping the source", () => {
+
Wonka_thelpers.testWithListenable(Wonka.skipWhile((_) => true))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| Pull, Pull |], [| End |]))
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
+
let end_: talkbackT = End;
+
Wonka_thelpers.testTalkbackEnd(Wonka.skipWhile((_) => false))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| end_ |], [| Push(1) |]))
describe("skipUntil", () => {
···
expect(res) |> toEqual([| End |]);
+
testPromise("follows the spec for listenables", () => {
+
Wonka_thelpers.testWithListenable(Wonka.skipUntil(Wonka.never))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| Pull, Pull, Pull |], [| End |]))
+
testPromise("follows the spec for listenables when skipping the source", () => {
+
Wonka_thelpers.testWithListenable(Wonka.skipUntil(Wonka.fromValue(0)))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| Pull |], [| Push(1), Push(2), End |]))
+
testPromise("ends itself and source when its talkback receives the End signal", () => {
+
let end_: talkbackT = End;
+
Wonka_thelpers.testTalkbackEnd(Wonka.skipUntil(Wonka.fromValue(0)))
+
|> Js.Promise.then_(x => {
+
|> toEqual(([| Pull, end_ |], [| Push(1) |]))