Files
trouvetonprofile/src/app/shared/components/my-profile-project-item/my-profile-project-item.component.spec.ts
styve Lioumba 4c1787d784 test au vert
2025-10-23 21:04:25 +02:00

43 lines
1.5 KiB
TypeScript

import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MyProfileProjectItemComponent } from './my-profile-project-item.component';
import { of } from 'rxjs';
import { Project } from '@app/domain/projects/project.model';
import { ProjectRepository } from '@app/domain/projects/project.repository';
import { provideRouter } from '@angular/router';
import { PROJECT_REPOSITORY_TOKEN } from '@app/infrastructure/projects/project-repository.token';
describe('MyProfileProjectItemComponent', () => {
let component: MyProfileProjectItemComponent;
let fixture: ComponentFixture<MyProfileProjectItemComponent>;
let mockProjectRepository: jest.Mocked<ProjectRepository>;
beforeEach(async () => {
mockProjectRepository = {
create: jest.fn().mockReturnValue(of({} as Project)),
list: jest.fn().mockReturnValue(of([])),
get: jest.fn().mockReturnValue(of({} as Project)),
update: jest.fn().mockReturnValue(of({} as Project)),
};
await TestBed.configureTestingModule({
imports: [MyProfileProjectItemComponent],
providers: [
provideRouter([]),
{ provide: PROJECT_REPOSITORY_TOKEN, useValue: mockProjectRepository },
],
}).compileComponents();
fixture = TestBed.createComponent(MyProfileProjectItemComponent);
component = fixture.componentInstance;
fixture.detectChanges();
await fixture.whenStable();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});