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

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

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

  it('maps logout result into response model', () => {
    presenter.present({ success: true });

    expect(presenter.getResponseModel()).toEqual({ success: true });
    expect(presenter.responseModel).toEqual({ success: true });
  });

  it('throws when not presented', () => {
    expect(() => presenter.getResponseModel()).toThrow('Presenter not presented');
    expect(() => presenter.responseModel).toThrow('Presenter not presented');
  });

  it('reset clears model', () => {
    presenter.present({ success: true });
    presenter.reset();

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