Files
gridpilot.gg/core/racing/domain/value-objects/TeamName.test.ts
2025-12-17 01:23:09 +01:00

32 lines
991 B
TypeScript

import { describe, it, expect } from 'vitest';
import { TeamName } from './TeamName';
describe('TeamName', () => {
it('should create team name', () => {
const name = TeamName.create('Test Team');
expect(name.toString()).toBe('Test Team');
expect(name.props).toBe('Test Team');
});
it('should trim whitespace', () => {
const name = TeamName.create(' Test Team ');
expect(name.toString()).toBe('Test Team');
});
it('should throw for empty name', () => {
expect(() => TeamName.create('')).toThrow('Team name is required');
expect(() => TeamName.create(' ')).toThrow('Team name is required');
});
it('should equal same names', () => {
const n1 = TeamName.create('Team A');
const n2 = TeamName.create('Team A');
expect(n1.equals(n2)).toBe(true);
});
it('should not equal different names', () => {
const n1 = TeamName.create('Team A');
const n2 = TeamName.create('Team B');
expect(n1.equals(n2)).toBe(false);
});
});