project et profile => clean archi et test vert
This commit is contained in:
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user