tjson-js
Version:
Tagged JSON (TJSON): a JSON-based microformat with rich type annotations
19 lines (15 loc) • 561 B
text/typescript
import { suite, test } from "mocha-typescript";
import { expect } from "chai";
import { BooleanType } from "../../src/datatype/boolean";
class BooleanValueTest {
"passes through boolean values"() {
expect((new BooleanType).decode(true)).to.eq(true);
expect((new BooleanType).decode(false)).to.eq(false);
}
"throw Error on null"() {
expect(() => (new BooleanType).decode(null)).to.throw(Error);
}
"throws Error on non-boolean values"() {
expect(() => (new BooleanType).decode("true")).to.throw(Error);
}
}