import { describe, it, expect, beforeEach, vi, Mock } from 'vitest';
import { ListLeagueScoringPresetsUseCase } from './ListLeagueScoringPresetsUseCase';
import { LeagueScoringPresetProvider } from '../ports/LeagueScoringPresetProvider';

describe('ListLeagueScoringPresetsUseCase', () => {
  let useCase: ListLeagueScoringPresetsUseCase;
  let presetProvider: {
    listPresets: Mock;
  };

  beforeEach(() => {
    presetProvider = {
      listPresets: vi.fn(),
    };
    useCase = new ListLeagueScoringPresetsUseCase(
      presetProvider as unknown as LeagueScoringPresetProvider,
    );
  });

  it('should list presets successfully', async () => {
    const mockPresets = [
      { id: 'preset-1', name: 'Preset 1' },
      { id: 'preset-2', name: 'Preset 2' },
    ];

    presetProvider.listPresets.mockResolvedValue(mockPresets);

    const result = await useCase.execute();

    expect(result.isOk()).toBe(true);
    expect(result.unwrap()).toEqual({
      presets: mockPresets,
    });
  });
});