import { describe, it, expect } from 'vitest';
import { RemoveMemberViewModel } from './RemoveMemberViewModel';
import type { RemoveLeagueMemberOutputDTO } from '../types/generated/RemoveLeagueMemberOutputDTO';

const createRemoveMemberDto = (overrides: Partial<RemoveLeagueMemberOutputDTO> = {}): RemoveLeagueMemberOutputDTO => ({
  success: true,
  ...overrides,
});

describe('RemoveMemberViewModel', () => {
  it('maps success flag from DTO', () => {
    const dto = createRemoveMemberDto({ success: true });

    const vm = new RemoveMemberViewModel(dto);

    expect(vm.success).toBe(true);
  });

  it('provides success message when operation succeeds', () => {
    const dto = createRemoveMemberDto({ success: true });

    const vm = new RemoveMemberViewModel(dto);

    expect(vm.successMessage).toBe('Member removed successfully!');
  });

  it('provides failure message when operation fails', () => {
    const dto = createRemoveMemberDto({ success: false });

    const vm = new RemoveMemberViewModel(dto);

    expect(vm.successMessage).toBe('Failed to remove member.');
  });
});
