13 lines
641 B
TypeScript
13 lines
641 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { berlinLocalToUtc } from './time.js';
|
|
|
|
describe('Berlin local time conversion', () => {
|
|
it('converts valid civil time and rejects normalized or nonexistent values', () => {
|
|
expect(berlinLocalToUtc('2026-10-25T20:00')).toBe('2026-10-25T19:00:00.000Z');
|
|
expect(berlinLocalToUtc('')).toBeNull();
|
|
expect(() => berlinLocalToUtc('2026-02-31T12:00')).toThrow('INVALID_TIMESTAMP');
|
|
expect(() => berlinLocalToUtc('2026-03-29T02:30', 'INVALID_EXPIRY')).toThrow('INVALID_EXPIRY');
|
|
expect(() => berlinLocalToUtc('2026-10-25T02:30', 'INVALID_EXPIRY')).toThrow('INVALID_EXPIRY');
|
|
});
|
|
});
|