Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function doesOccur<A>(
CombineFuture.prototype.model = function() {
const a = this.parentA.model();
const b = this.parentB.model();
return a.time <= b.time ? a : b;
return doesOccur(a) && (!doesOccur(b) || a.time <= b.time) ? a : b;
};

MapFuture.prototype.model = function() {
Expand Down
16 changes: 15 additions & 1 deletion test/testing.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assert } from "chai";
import * as H from "../src";
import { Behavior, Stream, Now } from "../src";
import { Behavior, Stream, never, Now } from "../src";
import {
testFuture,
assertFutureEqual,
Expand Down Expand Up @@ -44,6 +44,20 @@ describe("testing", () => {
const res = H.combine(fut1, fut2);
assertFutureEqual(res, fut2);
});
it("gives first future if only resolved", () => {
const fut1 = testFuture(4, "foo");
const res = H.combine(fut1, never);
assertFutureEqual(res, fut1);
});
it("gives second future if only resolved", () => {
const fut2 = testFuture(3, "bar");
const res = H.combine(never, fut2);
assertFutureEqual(res, fut2);
});
it("gives never if none resolved", () => {
const res = H.combine(never, never);
assertFutureEqual(res, never);
});
});
describe("functor", () => {
it("maps value", () => {
Expand Down