CoastalCommitsPastes/client/lib/__tests__/time-ago.ts
2022-04-16 22:43:57 -07:00

11 lines
352 B
TypeScript

import { timeAgo } from "@lib/time-ago";
describe("timeAgo", () => {
it("should return '1 second ago' for 1 second ago", () => {
expect(timeAgo(new Date(Date.now() - 1000))).toBe("1 second ago");
});
it("should handle negative values", () => {
expect(timeAgo(new Date(Date.now() - -1000))).toBe("0 second ago");
})
})