12 lines
439 B
TypeScript
12 lines
439 B
TypeScript
import dayjs from '../plugins/dayjs';
|
|
import { formatRelativeTimeAgo } from './formatRelativeTimeAgo';
|
|
|
|
describe('formatRelativeTimeAgo', () => {
|
|
it('formats a relative time from the provided now date', () => {
|
|
const now = new Date('2026-01-02T12:00:00.000Z');
|
|
const earlier = new Date('2026-01-02T11:00:00.000Z');
|
|
|
|
expect(formatRelativeTimeAgo(earlier, now)).toBe(dayjs(earlier).from(dayjs(now)));
|
|
});
|
|
});
|