UNPKG

@brimdata/zealot

Version:

The Javascript Client for Zed Lakes

27 lines (26 loc) 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const _time = require("./time"); const _factory = require("../../test/factory"); test("toDate()", ()=>{ new _time.Time("2020-02-25T16:03:13.987654321Z").toDate(); new _time.Time("2020-02-25T16:03:13.87654321Z").toDate(); new _time.Time("2020-02-25T16:03:13.7654321Z").toDate(); new _time.Time("2020-02-25T16:03:13.654321Z").toDate(); new _time.Time("2020-02-25T16:03:13.54321Z").toDate(); new _time.Time("2020-02-25T16:03:13.4321Z").toDate(); new _time.Time("2020-02-25T16:03:13.321Z").toDate(); new _time.Time("2020-02-25T16:03:13.21Z").toDate(); new _time.Time("2020-02-25T16:03:13.1Z").toDate(); new _time.Time("2020-02-25T16:03:13Z").toDate(); }); test("create record with time field", ()=>{ const t = (0, _factory.createData)(new Date(0)); expect(t.toDate()).toEqual(new Date(0)); }); test("keeps the milliseconds", ()=>{ const date = new _time.Time("2020-02-25T16:03:17.838527Z").toDate(); expect(date?.toISOString()).toEqual("2020-02-25T16:03:17.838Z"); });