Path: blob/master/src/packages/database/pool/util.test.ts
1496 views
import { timeInSeconds } from "./util";12test("use the timeInSeconds code gen function", () => {3const s = timeInSeconds("public_paths.last_edited", "last_edited");4expect(s).toEqual(5" (EXTRACT(EPOCH FROM public_paths.last_edited)*1000)::FLOAT as last_edited "6);7});89import { expireTime } from "./util";1011test("using expireTime to compute a time in the future", () => {12const now = new Date().getTime();13const now10 = expireTime(10).getTime();14// sometimes, this is off by one. expect.toBeCloseTo only checks after the decimal point15// increasing to 100 due to flakiness -- https://github.com/sagemathinc/cocalc/issues/638716expect(Math.abs(now10 - now - 10000)).toBeLessThanOrEqual(100);17});181920