import { RatingDimensionKey } from './RatingDimensionKey';
import { IdentityDomainValidationError } from '../errors/IdentityDomainError';

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

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

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

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

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

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

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

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