import { QuotaExceededEvent } from '../events/quota-exceeded.event';

describe('QuotaExceededEvent', () => {
  it('creates event with correct properties', () => {
    const event = new QuotaExceededEvent('user-1', 'listings_created', 3, 3);

    expect(event.eventName).toBe('quota.exceeded');
    expect(event.aggregateId).toBe('user-1');
    expect(event.metric).toBe('listings_created');
    expect(event.limit).toBe(3);
    expect(event.used).toBe(3);
    expect(event.occurredAt).toBeInstanceOf(Date);
  });

  it('creates event for analytics metric', () => {
    const event = new QuotaExceededEvent('user-2', 'analytics_queries', 0, 0);

    expect(event.metric).toBe('analytics_queries');
    expect(event.limit).toBe(0);
  });
});
