import {isNumberValue, numberValue, ScriptValueTypes} from "./ScriptValue"; describe("NumberValue", () => { describe("constructor", () => { test("forwards number parameter to the value property", () => { expect(numberValue(5)).toEqual({ type: ScriptValueTypes.NUMBER, value: 5 }) }) test("parses string parameter to the value property", () => { expect(numberValue("99")).toEqual({ type: ScriptValueTypes.NUMBER, value: 99 }) }) }) describe("typecheck", () => { test("passes on the output of the constructor", () => { expect(isNumberValue(numberValue(2))).toBeTruthy() }) test("passes on a hand-constructed instance", () => { expect(isNumberValue({ type: ScriptValueTypes.NUMBER, value: 21 })).toBeTruthy() }) }) })