refactor
This commit is contained in:
31
core/racing/domain/value-objects/driver/DriverBio.test.ts
Normal file
31
core/racing/domain/value-objects/driver/DriverBio.test.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { DriverBio } from './DriverBio';
|
||||
|
||||
describe('DriverBio', () => {
|
||||
it('should create a driver bio', () => {
|
||||
const bio = DriverBio.create('A passionate racer.');
|
||||
expect(bio.toString()).toBe('A passionate racer.');
|
||||
});
|
||||
|
||||
it('should allow empty string', () => {
|
||||
const bio = DriverBio.create('');
|
||||
expect(bio.toString()).toBe('');
|
||||
});
|
||||
|
||||
it('should throw on bio too long', () => {
|
||||
const longBio = 'a'.repeat(501);
|
||||
expect(() => DriverBio.create(longBio)).toThrow('Driver bio cannot exceed 500 characters');
|
||||
});
|
||||
|
||||
it('should equal same bio', () => {
|
||||
const b1 = DriverBio.create('Racer');
|
||||
const b2 = DriverBio.create('Racer');
|
||||
expect(b1.equals(b2)).toBe(true);
|
||||
});
|
||||
|
||||
it('should not equal different bio', () => {
|
||||
const b1 = DriverBio.create('Racer');
|
||||
const b2 = DriverBio.create('Driver');
|
||||
expect(b1.equals(b2)).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user