import * as B from "." import { isEventStream, isEventStreamSeed, isProperty, isPropertySeed, isPropertySource, Observable, PropertySeed, PropertySource, } from "./abstractions" import { constant } from "./constant" import { globalScope } from "./scope" import { nop } from "./util" describe("Property", () => { describe("Basics", () => { it("Uses inheritance", () => { const p = constant(1) expect(isProperty(p)).toEqual(true) expect(isPropertySeed(p)).toEqual(true) expect(isPropertySource(p)).toEqual(true) expect(isEventStream(p)).toEqual(false) expect(isEventStreamSeed(p)).toEqual(false) // Making sure the methods are available through these interfaces p.forEach(nop) ;(p as Observable).forEach(nop) ;(p as Observable).subscribe(nop, nop) ;(p as Observable).log ;(p as Observable).desc ;(p as PropertySeed).forEach(nop) ;(p as PropertySeed).log ;(p as PropertySeed).desc ;(p as PropertySource).forEach(nop) ;(p as PropertySource).subscribe(nop, nop) ;(p as PropertySource).log ;(p as PropertySource).desc }) it("Has synchronous current value", () => { const prop = B.toProperty("hello", globalScope)(B.never()) expect(prop.get()).toEqual("hello") }) }) })