import { describe, expect, it } from 'vitest';
import { formatGuestMessageDate } from '../guestMessages';

describe('guest messages helpers', () => {
  it('returns placeholder for empty value', () => {
    expect(formatGuestMessageDate(null, 'en-GB')).toBe('—');
  });

  it('passes through invalid dates', () => {
    const value = 'not-a-date';
    expect(formatGuestMessageDate(value, 'de-DE')).toBe(value);
  });

  it('formats valid ISO timestamps', () => {
    const formatted = formatGuestMessageDate('2024-01-02T12:00:00Z', 'en-GB');
    expect(formatted).not.toBe('—');
    expect(formatted).not.toBe('2024-01-02T12:00:00Z');
    expect(formatted).toContain('2024');
  });
});
