import { TeamRatingDimensionKey } from './TeamRatingDimensionKey';
import { RacingDomainValidationError } from '../errors/RacingDomainError';

describe('TeamRatingDimensionKey', () => {
  describe('create', () => {
    it('should create valid dimension keys', () => {
      expect(TeamRatingDimensionKey.create('driving').value).toBe('driving');
      expect(TeamRatingDimensionKey.create('adminTrust').value).toBe('adminTrust');
    });

    it('should throw for invalid dimension key', () => {
      expect(() => TeamRatingDimensionKey.create('invalid')).toThrow(RacingDomainValidationError);
      expect(() => TeamRatingDimensionKey.create('driving ')).toThrow(RacingDomainValidationError);
      expect(() => TeamRatingDimensionKey.create('')).toThrow(RacingDomainValidationError);
    });

    it('should throw for empty string', () => {
      expect(() => TeamRatingDimensionKey.create('')).toThrow(RacingDomainValidationError);
    });

    it('should throw for whitespace', () => {
      expect(() => TeamRatingDimensionKey.create('  ')).toThrow(RacingDomainValidationError);
    });

    it('should return true for same value', () => {
      const key1 = TeamRatingDimensionKey.create('driving');
      const key2 = TeamRatingDimensionKey.create('driving');
      expect(key1.equals(key2)).toBe(true);
    });

    it('should return false for different values', () => {
      const key1 = TeamRatingDimensionKey.create('driving');
      const key2 = TeamRatingDimensionKey.create('adminTrust');
      expect(key1.equals(key2)).toBe(false);
    });

    it('should expose props correctly', () => {
      const key = TeamRatingDimensionKey.create('driving');
      expect(key.props.value).toBe('driving');
    });

    it('should return string representation', () => {
      const key = TeamRatingDimensionKey.create('driving');
      expect(key.toString()).toBe('driving');
    });
  });
});