website refactor
This commit is contained in:
29
core/racing/domain/value-objects/RacingId.test.ts
Normal file
29
core/racing/domain/value-objects/RacingId.test.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { RacingId } from './RacingId';
|
||||
|
||||
describe('IRacingId', () => {
|
||||
it('should create an iRacing id', () => {
|
||||
const id = IRacingId.create('12345');
|
||||
expect(id.toString()).toBe('12345');
|
||||
});
|
||||
|
||||
it('should throw on empty id', () => {
|
||||
expect(() => IRacingId.create('')).toThrow('iRacing ID is required');
|
||||
});
|
||||
|
||||
it('should throw on whitespace id', () => {
|
||||
expect(() => IRacingId.create(' ')).toThrow('iRacing ID is required');
|
||||
});
|
||||
|
||||
it('should equal same id', () => {
|
||||
const id1 = IRacingId.create('12345');
|
||||
const id2 = IRacingId.create('12345');
|
||||
expect(id1.equals(id2)).toBe(true);
|
||||
});
|
||||
|
||||
it('should not equal different id', () => {
|
||||
const id1 = IRacingId.create('12345');
|
||||
const id2 = IRacingId.create('67890');
|
||||
expect(id1.equals(id2)).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user