Files
Gabriel Brown 42f95530de
Build and Push Next App / quality (push) Successful in 1m27s
Build and Push Next App / build-next (push) Successful in 3m58s
Update expo application
2026-06-22 12:13:02 -04:00

32 lines
808 B
TypeScript

import { describe, expect, test } from 'vitest';
import {
formatDate,
formatDateTime,
titleize,
truncate,
} from '../../src/utils/format';
describe('format utilities', () => {
test('formats missing timestamps as never', () => {
expect(formatDate(undefined)).toBe('Never');
expect(formatDateTime(undefined)).toBe('Never');
});
test('formats known timestamps', () => {
const value = Date.UTC(2026, 0, 2, 3, 4, 5);
expect(formatDate(value)).toContain('2026');
expect(formatDateTime(value)).toContain('2026');
});
test('titleizes machine values', () => {
expect(titleize('waiting_for_user')).toBe('waiting for user');
});
test('truncates long text', () => {
expect(truncate('abcdef', 4)).toBe('a...');
expect(truncate('abc', 4)).toBe('abc');
});
});