project et profile => clean archi et test vert

This commit is contained in:
styve Lioumba
2025-10-24 16:18:27 +02:00
parent 4c1787d784
commit 3654709250
48 changed files with 762 additions and 656 deletions

View File

@@ -4,12 +4,17 @@ import { MyProfileUpdateFormComponent } from './my-profile-update-form.component
import { provideRouter } from '@angular/router';
import { ToastrService } from 'ngx-toastr';
import { FormBuilder } from '@angular/forms';
import { PROFILE_REPOSITORY_TOKEN } from '@app/infrastructure/profiles/profile-repository.token';
import { ProfileRepository } from '@app/domain/profiles/profile.repository';
import { of } from 'rxjs';
import { Profile } from '@app/domain/profiles/profile.model';
describe('MyProfileUpdateFormComponent', () => {
let component: MyProfileUpdateFormComponent;
let fixture: ComponentFixture<MyProfileUpdateFormComponent>;
let mockToastrService: Partial<ToastrService>;
let mockProfileRepo: ProfileRepository;
const mockProfileData = {
profession: '',
@@ -26,18 +31,28 @@ describe('MyProfileUpdateFormComponent', () => {
error: jest.fn(),
};
mockProfileRepo = {
create: jest.fn(),
list: jest.fn(),
update: jest.fn().mockReturnValue(of({} as Profile)),
getByUserId: jest.fn().mockReturnValue(of({} as Profile)),
};
await TestBed.configureTestingModule({
imports: [MyProfileUpdateFormComponent],
providers: [
FormBuilder,
provideRouter([]),
{ provide: ToastrService, useValue: mockToastrService },
{ provide: PROFILE_REPOSITORY_TOKEN, useValue: mockProfileRepo },
],
}).compileComponents();
fixture = TestBed.createComponent(MyProfileUpdateFormComponent);
component = fixture.componentInstance;
fixture.detectChanges();
await fixture.whenStable();
});
it('should create', () => {