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

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

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

  describe('present', () => {
    it('should map parameters to response model for registered driver', () => {
      presenter.present({ isRegistered: true, raceId: 'race-123', driverId: 'driver-456' });

      const result = presenter.getResponseModel();

      expect(result).toEqual({
        isRegistered: true,
        raceId: 'race-123',
        driverId: 'driver-456',
      });
    });

    it('should map parameters to response model for unregistered driver', () => {
      presenter.present({ isRegistered: false, raceId: 'race-789', driverId: 'driver-101' });

      const result = presenter.getResponseModel();

      expect(result).toEqual({
        isRegistered: false,
        raceId: 'race-789',
        driverId: 'driver-101',
      });
    });
  });

  describe('reset', () => {
    it('should reset the result', () => {
      presenter.present({ isRegistered: true, raceId: 'race-123', driverId: 'driver-456' });
      expect(presenter.getResponseModel()).toBeDefined();

      presenter.reset();
      expect(() => presenter.getResponseModel()).toThrow('Presenter not presented');
    });
  });
});