test(api): add domain layer unit tests across all modules
Cover admin events, notifications, reviews, search VOs, listings (property, media, events, price/geo/address VOs), auth events, payment events, subscription events, and analytics events. Raises domain test coverage from ~24% to ~75%. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { MarketIndexUpdatedEvent } from '../events/market-index-updated.event';
|
||||
|
||||
describe('Analytics Domain Events', () => {
|
||||
describe('MarketIndexUpdatedEvent', () => {
|
||||
it('creates event with correct properties', () => {
|
||||
const event = new MarketIndexUpdatedEvent('index-1', 'Quận 1', 'Hồ Chí Minh', '2026-Q1');
|
||||
|
||||
expect(event.eventName).toBe('market-index.updated');
|
||||
expect(event.aggregateId).toBe('index-1');
|
||||
expect(event.district).toBe('Quận 1');
|
||||
expect(event.city).toBe('Hồ Chí Minh');
|
||||
expect(event.period).toBe('2026-Q1');
|
||||
expect(event.occurredAt).toBeInstanceOf(Date);
|
||||
});
|
||||
|
||||
it('creates event for different district', () => {
|
||||
const event = new MarketIndexUpdatedEvent('index-2', 'Thủ Đức', 'Hồ Chí Minh', '2026-Q1');
|
||||
expect(event.district).toBe('Thủ Đức');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user