import { describe, it, expect, beforeEach } from 'vitest';
import { GetDashboardDataPresenter } from './GetDashboardDataPresenter';
import type { GetDashboardDataOutput } from '@core/analytics/application/use-cases/GetDashboardDataUseCase';

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

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

  it('maps output to DTO correctly', () => {
    const output: GetDashboardDataOutput = {
      totalUsers: 100,
      activeUsers: 50,
      totalRaces: 20,
      totalLeagues: 5,
    };

    presenter.present(output);

    expect(presenter.getResponseModel()).toEqual({
      totalUsers: 100,
      activeUsers: 50,
      totalRaces: 20,
      totalLeagues: 5,
    });
    expect(presenter.responseModel).toEqual({
      totalUsers: 100,
      activeUsers: 50,
      totalRaces: 20,
      totalLeagues: 5,
    });
  });

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