import { ResetPasswordPresenter } from './ResetPasswordPresenter';

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

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

  describe('present', () => {
    it('should map result to response model', () => {
      const result = { message: 'Password reset successfully. You can now log in with your new password.' };

      presenter.present(result);

      expect(presenter.responseModel).toEqual({ message: 'Password reset successfully. You can now log in with your new password.' });
    });

    it('should handle different message', () => {
      const result = { message: 'Password updated' };

      presenter.present(result);

      expect(presenter.responseModel).toEqual({ message: 'Password updated' });
    });
  });

  describe('reset', () => {
    it('should clear the response model', () => {
      presenter.present({ message: 'Password reset successfully' });
      expect(presenter.responseModel).toBeDefined();

      presenter.reset();
      expect(() => presenter.responseModel).toThrow('ResetPasswordPresenter: No response model available');
    });
  });

  describe('responseModel', () => {
    it('should throw error when accessed before present()', () => {
      expect(() => presenter.responseModel).toThrow('ResetPasswordPresenter: No response model available');
    });
  });
});