refactor
This commit is contained in:
32
core/racing/domain/value-objects/TeamName.test.ts
Normal file
32
core/racing/domain/value-objects/TeamName.test.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user