import { describe, it, expect, beforeEach } from 'vitest';
import { RecordPageViewPresenter } from './RecordPageViewPresenter';
import type { RecordPageViewOutput } from '@core/analytics/application/use-cases/RecordPageViewUseCase';

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

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

  it('maps output to DTO correctly', () => {
    const output: RecordPageViewOutput = {
      pageViewId: 'pv-123',
    };

    presenter.present(output);

    expect(presenter.getResponseModel()).toEqual({
      pageViewId: 'pv-123',
    });
    expect(presenter.responseModel).toEqual({
      pageViewId: 'pv-123',
    });
  });

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