import { CompleteOnboardingPresenter } from './CompleteOnboardingPresenter';

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

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

  describe('present', () => {
    it('should map result to response model', () => {
      const result = {
        driver: {
          id: 'driver-123',
        } as never,
      };

      presenter.present(result);

      expect(presenter.getResponseModel()).toEqual({
        success: true,
        driverId: 'driver-123',
      });
    });

    it('should handle different driver IDs', () => {
      const result = {
        driver: {
          id: 'driver-456',
        } as never,
      };

      presenter.present(result);

      expect(presenter.getResponseModel()).toEqual({
        success: true,
        driverId: 'driver-456',
      });
    });
  });

  describe('getResponseModel', () => {
    it('should throw error when accessed before present()', () => {
      expect(() => presenter.getResponseModel()).toThrow('Presenter not presented');
    });

    it('should return model after present()', () => {
      presenter.present({ driver: { id: 'driver-123' } } as never);
      expect(presenter.getResponseModel()).toEqual({
        success: true,
        driverId: 'driver-123',
      });
    });
  });
});