import { describe, it, expect } from 'vitest';

import { updateUserSchema } from '@/lib/validators/users';

describe('updateUserSchema.signingEmail', () => {
  it('accepts and preserves a valid signing email', () => {
    const parsed = updateUserSchema.parse({ signingEmail: 'sales@portnimara.com' });
    expect(parsed.signingEmail).toBe('sales@portnimara.com');
  });

  it('allows an empty string (sentinel for "clear the override")', () => {
    const parsed = updateUserSchema.parse({ signingEmail: '' });
    expect(parsed.signingEmail).toBe('');
  });

  it('rejects a malformed signing email', () => {
    expect(() => updateUserSchema.parse({ signingEmail: 'not-an-email' })).toThrow();
  });
});
