Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { dateToIsoSupressMillis } from '../GenericFunctions';
|
|
|
|
describe('dateToIsoSupressMillis', () => {
|
|
it('should return an ISO string without milliseconds (UTC)', () => {
|
|
const dateTime = '2024-12-25T10:15:30.123Z';
|
|
const result = dateToIsoSupressMillis(dateTime);
|
|
expect(result).toBe('2024-12-25T10:15:30.123+00:00');
|
|
});
|
|
|
|
it('should handle dates without milliseconds correctly', () => {
|
|
const dateTime = '2024-12-25T10:15:30Z';
|
|
const result = dateToIsoSupressMillis(dateTime);
|
|
expect(result).toBe('2024-12-25T10:15:30+00:00');
|
|
});
|
|
|
|
it('should handle time zone offsets correctly', () => {
|
|
const dateTime = '2024-12-25T10:15:30.123+02:00';
|
|
const result = dateToIsoSupressMillis(dateTime);
|
|
expect(result).toBe('2024-12-25T08:15:30.123+00:00');
|
|
});
|
|
|
|
it('should handle edge case for empty input', () => {
|
|
const dateTime = '';
|
|
const result = dateToIsoSupressMillis(dateTime);
|
|
expect(result).toBeNull();
|
|
});
|
|
|
|
it('should handle edge case for null input', () => {
|
|
const dateTime = null as unknown as string;
|
|
const result = dateToIsoSupressMillis(dateTime);
|
|
expect(result).toBeNull();
|
|
});
|
|
});
|