37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { describe, expect, it } 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);
|
|
});
|
|
}); |