Almost running
- NEVER use undefined as the default for behaviors (FOOTGUN)
This commit is contained in:
@@ -7,8 +7,14 @@ Please see LICENSE in the repository root for full details.
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Epoch, mapEpoch, trackEpoch } from "./ObservableScope";
|
||||
import {
|
||||
Epoch,
|
||||
mapEpoch,
|
||||
ObservableScope,
|
||||
trackEpoch,
|
||||
} from "./ObservableScope";
|
||||
import { withTestScheduler } from "../utils/test";
|
||||
import { BehaviorSubject, timer } from "rxjs";
|
||||
|
||||
describe("Epoch", () => {
|
||||
it("should map the value correctly", () => {
|
||||
@@ -53,4 +59,17 @@ describe("Epoch", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
it("obs", () => {
|
||||
const nothing = Symbol("nothing");
|
||||
const scope = new ObservableScope();
|
||||
const sb$ = new BehaviorSubject("initial");
|
||||
const su$ = new BehaviorSubject(undefined);
|
||||
expect(sb$.value).toBe("initial");
|
||||
expect(su$.value).toBe(undefined);
|
||||
expect(su$.value === nothing).toBe(false);
|
||||
|
||||
const a$ = timer(10);
|
||||
|
||||
scope.behavior(a$, undefined);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user