tjson-js
Version:
Tagged JSON (TJSON): a JSON-based microformat with rich type annotations
14 lines (11 loc) • 487 B
text/typescript
import { suite, test } from "mocha-typescript";
import { expect } from "chai";
import { TimestampType } from "../../src/datatype/timestamp";
class TimestampTypeTest {
"parses valid UTC RFC3339 timestamps"() {
expect((new TimestampType).decode("2016-10-02T07:31:51Z")).to.be.a.instanceOf(Date);
}
"throws Error on RFC3339 timestamp with non-UTC time zone"() {
expect(() => (new TimestampType).decode("2016-10-02T07:31:51-08:00")).to.throw(Error);
}
}