import { FakeAuthRepository } from '@app/testing/domain/authentification/fake-auth.repository';
import { LoginUseCase } from '@app/application/authentification/login.usecase';
import { LoginDto } from '@app/domain/authentification/dto/login-dto';
import { firstValueFrom } from 'rxjs';

describe('LoginUsecase', () => {
  it('devrait se connecter ', async () => {
    const repo = new FakeAuthRepository();
    const useCase = new LoginUseCase(repo);

    const loginDto: LoginDto = {
      email: 'foo@bar.com',
      password: 'password1234',
    };

    const response = await firstValueFrom(useCase.execute(loginDto));

    expect(response.isValid).toBe(true);
    expect(response.token).toEqual('fakeToken');
  });
});
