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

import { DemoImageServiceAdapter } from '@core/testing-support';

describe('DemoImageServiceAdapter - driver avatars', () => {
  it('returns male default avatar for a demo driver treated as male (odd id suffix)', () => {
    // Given a demo driver id that maps to a male profile
    const adapter = new DemoImageServiceAdapter();

    // When resolving the driver avatar
    const src = adapter.getDriverAvatar('driver-1');

    // Then it should use the male default avatar asset
    expect(src).toBe('/images/avatars/male-default-avatar.jpg');
  });

  it('returns female default avatar for a demo driver treated as female (even id suffix)', () => {
    // Given a demo driver id that maps to a female profile
    const adapter = new DemoImageServiceAdapter();

    // When resolving the driver avatar
    const src = adapter.getDriverAvatar('driver-2');

    // Then it should use the female default avatar asset
    expect(src).toBe('/images/avatars/female-default-avatar.jpeg');
  });

  it('falls back to a sensible default avatar when driver id has no numeric suffix', () => {
    // Given a demo driver id without a numeric suffix
    const adapter = new DemoImageServiceAdapter();

    // When resolving the driver avatar
    const src = adapter.getDriverAvatar('demo-driver');

    // Then it should still resolve to one of the default avatar assets
    expect(['/images/avatars/male-default-avatar.jpg', '/images/avatars/female-default-avatar.jpeg']).toContain(
      src,
    );
  });
});