import { describe, expect, it } from 'vitest';
import { toCampusCatalogViewModels } from '@/business/campuses/mappers';
import { campusCatalogItemSeed } from '@/test-seeds/campuses';

describe('campus catalog mappers', () => {
  it('maps backend campus rows to UI campus view models', () => {
    expect(toCampusCatalogViewModels([campusCatalogItemSeed])).toEqual([
      {
        id: 'tigers',
        mascot: 'Tigers',
        fullName: 'Tigers Campus',
        color: 'bg-orange-500',
        bgGradient: 'from-orange-500 to-amber-500',
        borderColor: 'border-orange-500/30',
        textColor: 'text-orange-400',
        bgLight: 'bg-orange-500/10',
        description: 'Strength, courage & determination',
        isOnline: false,
      },
    ]);
  });

  it('omits backend campus rows without a usable code', () => {
    expect(toCampusCatalogViewModels([{ ...campusCatalogItemSeed, code: '   ' }])).toEqual([]);
  });
});
