Files
gridpilot.gg/core/racing/domain/value-objects/driver/DriverBio.test.ts
2026-01-16 19:46:49 +01:00

31 lines
938 B
TypeScript

import { describe, expect, it } 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);
});
});