import { describe, expect, it } from 'vitest'; import { Game } from './Game'; describe('Game', () => { it('should create a game', () => { const game = Game.create({ id: 'game1', name: 'iRacing', }); expect(game.id.toString()).toBe('game1'); expect(game.name.toString()).toBe('iRacing'); }); it('should throw on invalid id', () => { expect(() => Game.create({ id: '', name: 'iRacing', })).toThrow('Game ID cannot be empty'); }); it('should throw on invalid name', () => { expect(() => Game.create({ id: 'game1', name: '', })).toThrow('Game name cannot be empty'); }); it('should throw on name too long', () => { const longName = 'a'.repeat(51); expect(() => Game.create({ id: 'game1', name: longName, })).toThrow('Game name cannot exceed 50 characters'); }); });