import { describe, it, expect } from 'vitest';
import { RecordEngagementOutputViewModel } from './RecordEngagementOutputViewModel';

describe('RecordEngagementOutputViewModel', () => {
  it('maps DTO fields into view model', () => {
    const dto = { eventId: 'evt-123', engagementWeight: 1.2345 } as any;

    const vm = new RecordEngagementOutputViewModel(dto);

    expect(vm.eventId).toBe('evt-123');
    expect(vm.engagementWeight).toBe(1.2345);
  });

  it('formats displayEventId with prefix', () => {
    const vm = new RecordEngagementOutputViewModel({ eventId: 'evt-999', engagementWeight: 0.5 } as any);

    expect(vm.displayEventId).toBe('Event: evt-999');
  });

  it('formats engagement weight to two decimals', () => {
    const vm = new RecordEngagementOutputViewModel({ eventId: 'evt', engagementWeight: 1.2 } as any);

    expect(vm.displayEngagementWeight).toBe('1.20');
  });

  it('flags high engagement above threshold', () => {
    const low = new RecordEngagementOutputViewModel({ eventId: 'evt', engagementWeight: 0.5 } as any);
    const high = new RecordEngagementOutputViewModel({ eventId: 'evt', engagementWeight: 1.5 } as any);

    expect(low.isHighEngagement).toBe(false);
    expect(high.isHighEngagement).toBe(true);
  });
});
