You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
975 B
29 lines
975 B
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()
|
|
})
|
|
})
|
|
}) |