test au vert

This commit is contained in:
styve Lioumba
2025-10-23 21:04:25 +02:00
parent 02637235e3
commit 4c1787d784
13 changed files with 482 additions and 855 deletions

View File

@@ -2,15 +2,30 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ProfileListComponent } from './profile-list.component';
import { provideRouter } from '@angular/router';
import { of } from 'rxjs';
import { ProfileRepository } from '@app/domain/profiles/profile.repository';
import { PROFILE_REPOSITORY_TOKEN } from '@app/infrastructure/profiles/profile-repository.token';
import { Profile } from '@app/domain/profiles/profile.model';
describe('ProfileListComponent', () => {
let component: ProfileListComponent;
let fixture: ComponentFixture<ProfileListComponent>;
let mockProfileRepository: jest.Mocked<ProfileRepository>;
beforeEach(async () => {
mockProfileRepository = {
create: jest.fn().mockReturnValue(of({} as Profile)),
list: jest.fn().mockReturnValue(of([])),
getByUserId: jest.fn().mockReturnValue(of({} as Profile)),
update: jest.fn().mockReturnValue(of({} as Profile)),
};
await TestBed.configureTestingModule({
imports: [ProfileListComponent],
providers: [provideRouter([])],
providers: [
provideRouter([]),
{ provide: PROFILE_REPOSITORY_TOKEN, useValue: mockProfileRepository },
],
}).compileComponents();
fixture = TestBed.createComponent(ProfileListComponent);