This commit is contained in:
2025-12-17 01:23:09 +01:00
parent f01e01e50c
commit 4d890863d3
73 changed files with 2632 additions and 3224 deletions

View File

@@ -0,0 +1,31 @@
import { describe, it, expect } from 'vitest';
import { TeamCreatedAt } from './TeamCreatedAt';
describe('TeamCreatedAt', () => {
it('should create team created at', () => {
const date = new Date('2023-01-01');
const created = TeamCreatedAt.create(date);
expect(created.toDate()).toEqual(date);
expect(created.props).toEqual(date);
});
it('should throw for future date', () => {
const future = new Date();
future.setFullYear(future.getFullYear() + 1);
expect(() => TeamCreatedAt.create(future)).toThrow('Created date cannot be in the future');
});
it('should equal same dates', () => {
const date1 = new Date('2023-01-01');
const date2 = new Date('2023-01-01');
const c1 = TeamCreatedAt.create(date1);
const c2 = TeamCreatedAt.create(date2);
expect(c1.equals(c2)).toBe(true);
});
it('should not equal different dates', () => {
const c1 = TeamCreatedAt.create(new Date('2023-01-01'));
const c2 = TeamCreatedAt.create(new Date('2023-01-02'));
expect(c1.equals(c2)).toBe(false);
});
});