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');
    });
  });
});
