Files
gridpilot.gg/core/racing/domain/value-objects/TrackCountry.test.ts
2025-12-17 01:23:09 +01:00

32 lines
1.0 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import { TrackCountry } from './TrackCountry';
describe('TrackCountry', () => {
it('should create track country', () => {
const country = TrackCountry.create('USA');
expect(country.toString()).toBe('USA');
expect(country.props).toBe('USA');
});
it('should trim whitespace', () => {
const country = TrackCountry.create(' USA ');
expect(country.toString()).toBe('USA');
});
it('should throw for empty country', () => {
expect(() => TrackCountry.create('')).toThrow('Track country is required');
expect(() => TrackCountry.create(' ')).toThrow('Track country is required');
});
it('should equal same countries', () => {
const c1 = TrackCountry.create('USA');
const c2 = TrackCountry.create('USA');
expect(c1.equals(c2)).toBe(true);
});
it('should not equal different countries', () => {
const c1 = TrackCountry.create('USA');
const c2 = TrackCountry.create('UK');
expect(c1.equals(c2)).toBe(false);
});
});