refactor
This commit is contained in:
32
core/racing/domain/value-objects/TeamDescription.test.ts
Normal file
32
core/racing/domain/value-objects/TeamDescription.test.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { TeamDescription } from './TeamDescription';
|
||||
|
||||
describe('TeamDescription', () => {
|
||||
it('should create team description', () => {
|
||||
const desc = TeamDescription.create('A great team');
|
||||
expect(desc.toString()).toBe('A great team');
|
||||
expect(desc.props).toBe('A great team');
|
||||
});
|
||||
|
||||
it('should trim whitespace', () => {
|
||||
const desc = TeamDescription.create(' Description ');
|
||||
expect(desc.toString()).toBe('Description');
|
||||
});
|
||||
|
||||
it('should throw for empty description', () => {
|
||||
expect(() => TeamDescription.create('')).toThrow('Team description is required');
|
||||
expect(() => TeamDescription.create(' ')).toThrow('Team description is required');
|
||||
});
|
||||
|
||||
it('should equal same descriptions', () => {
|
||||
const d1 = TeamDescription.create('Desc A');
|
||||
const d2 = TeamDescription.create('Desc A');
|
||||
expect(d1.equals(d2)).toBe(true);
|
||||
});
|
||||
|
||||
it('should not equal different descriptions', () => {
|
||||
const d1 = TeamDescription.create('Desc A');
|
||||
const d2 = TeamDescription.create('Desc B');
|
||||
expect(d1.equals(d2)).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user