import { describe, it, expect, beforeEach } from 'vitest';
import { RecordEngagementPresenter } from './RecordEngagementPresenter';
import type { RecordEngagementOutput } from '@core/analytics/application/use-cases/RecordEngagementUseCase';

describe('RecordEngagementPresenter', () => {
  let presenter: RecordEngagementPresenter;

  beforeEach(() => {
    presenter = new RecordEngagementPresenter();
  });

  it('maps output to DTO correctly', () => {
    const output: RecordEngagementOutput = {
      eventId: 'event-123',
      engagementWeight: 10,
    };

    presenter.present(output);

    expect(presenter.getResponseModel()).toEqual({
      eventId: 'event-123',
      engagementWeight: 10,
    });
    expect(presenter.responseModel).toEqual({
      eventId: 'event-123',
      engagementWeight: 10,
    });
  });

  it('getResponseModel throws if not presented', () => {
    expect(() => presenter.getResponseModel()).toThrow('Presenter not presented');
  });

  it('responseModel throws if not presented', () => {
    expect(() => presenter.responseModel).toThrow('Presenter not presented');
  });
});
