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

import { getProfileAvatarPreviewUrl, getProfileCardStatusText } from './profileCard';

describe('getProfileCardStatusText', () => {
  it('uses the trimmed custom status when one is set', () => {
    expect(getProfileCardStatusText('  am Coden  ')).toBe('am Coden');
  });

  it('falls back to a neutral empty-status label', () => {
    expect(getProfileCardStatusText('')).toBe('Kein Status gesetzt');
    expect(getProfileCardStatusText(null)).toBe('Kein Status gesetzt');
  });
});

describe('getProfileAvatarPreviewUrl', () => {
  it('returns a trimmed avatar url when one is available', () => {
    expect(getProfileAvatarPreviewUrl('  https://example.com/avatar.png  ')).toBe(
      'https://example.com/avatar.png',
    );
  });

  it('returns null when no avatar image can be opened', () => {
    expect(getProfileAvatarPreviewUrl(null)).toBeNull();
    expect(getProfileAvatarPreviewUrl('')).toBeNull();
  });
});
