This commit is contained in:
2025-12-29 22:27:33 +01:00
parent 3f610c1cb6
commit 7a853d4e43
96 changed files with 14790 additions and 111 deletions

View File

@@ -0,0 +1,56 @@
import { GameKey } from './GameKey';
import { IdentityDomainValidationError } from '../errors/IdentityDomainError';
describe('GameKey', () => {
describe('create', () => {
it('should create valid game keys', () => {
expect(GameKey.create('iracing').value).toBe('iracing');
expect(GameKey.create('acc').value).toBe('acc');
expect(GameKey.create('f1').value).toBe('f1');
});
it('should throw for invalid game key', () => {
expect(() => GameKey.create('')).toThrow(IdentityDomainValidationError);
expect(() => GameKey.create(' ')).toThrow(IdentityDomainValidationError);
expect(() => GameKey.create('invalid game')).toThrow(IdentityDomainValidationError);
});
it('should trim whitespace', () => {
const key = GameKey.create(' iracing ');
expect(key.value).toBe('iracing');
});
it('should accept lowercase', () => {
const key = GameKey.create('iracing');
expect(key.value).toBe('iracing');
});
});
describe('equals', () => {
it('should return true for same value', () => {
const key1 = GameKey.create('iracing');
const key2 = GameKey.create('iracing');
expect(key1.equals(key2)).toBe(true);
});
it('should return false for different values', () => {
const key1 = GameKey.create('iracing');
const key2 = GameKey.create('acc');
expect(key1.equals(key2)).toBe(false);
});
});
describe('props', () => {
it('should expose props correctly', () => {
const key = GameKey.create('iracing');
expect(key.props.value).toBe('iracing');
});
});
describe('toString', () => {
it('should return string representation', () => {
const key = GameKey.create('iracing');
expect(key.toString()).toBe('iracing');
});
});
});