32 lines
991 B
TypeScript
32 lines
991 B
TypeScript
import { describe, expect, it } 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);
|
|
});
|
|
}); |