refactor
This commit is contained in:
37
core/racing/domain/value-objects/LeagueTimezone.test.ts
Normal file
37
core/racing/domain/value-objects/LeagueTimezone.test.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { LeagueTimezone } from './LeagueTimezone';
|
||||
|
||||
describe('LeagueTimezone', () => {
|
||||
it('should create valid timezone', () => {
|
||||
const tz = LeagueTimezone.create('America/New_York');
|
||||
expect(tz.id).toBe('America/New_York');
|
||||
});
|
||||
|
||||
it('should trim whitespace', () => {
|
||||
const tz = LeagueTimezone.create(' America/New_York ');
|
||||
expect(tz.id).toBe('America/New_York');
|
||||
});
|
||||
|
||||
it('should validate non-empty', () => {
|
||||
expect(() => LeagueTimezone.create('')).toThrow('LeagueTimezone id must be a non-empty string');
|
||||
expect(() => LeagueTimezone.create(' ')).toThrow('LeagueTimezone id must be a non-empty string');
|
||||
});
|
||||
|
||||
it('should have props', () => {
|
||||
const tz = LeagueTimezone.create('UTC');
|
||||
expect(tz.props).toEqual({ id: 'UTC' });
|
||||
});
|
||||
|
||||
it('should toString', () => {
|
||||
const tz = LeagueTimezone.create('UTC');
|
||||
expect(tz.toString()).toBe('UTC');
|
||||
});
|
||||
|
||||
it('equals', () => {
|
||||
const tz1 = LeagueTimezone.create('UTC');
|
||||
const tz2 = LeagueTimezone.create('UTC');
|
||||
const tz3 = LeagueTimezone.create('EST');
|
||||
expect(tz1.equals(tz2)).toBe(true);
|
||||
expect(tz1.equals(tz3)).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user