UNPKG

@cocalc/database

Version:

CoCalc: code for working with our PostgreSQL database

15 lines 750 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const util_1 = require("./util"); test("use the timeInSeconds code gen function", () => { const s = (0, util_1.timeInSeconds)("public_paths.last_edited", "last_edited"); expect(s).toEqual(" (EXTRACT(EPOCH FROM public_paths.last_edited)*1000)::FLOAT as last_edited "); }); const util_2 = require("./util"); test("using expireTime to compute a time in the future", () => { const now = new Date().getTime(); const now10 = (0, util_2.expireTime)(10).getTime(); // sometimes, this is off by one. expect.toBeCloseTo only checks after the decimal point expect(Math.abs(now10 - now - 10000)).toBeLessThanOrEqual(1); }); //# sourceMappingURL=util.test.js.map