test au vert
This commit is contained in:
@@ -4,6 +4,10 @@ import { ProjectPictureFormComponent } from './project-picture-form.component';
|
||||
import { provideRouter } from '@angular/router';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { AuthService } from '@app/core/services/authentication/auth.service';
|
||||
import { PROJECT_REPOSITORY_TOKEN } from '@app/infrastructure/projects/project-repository.token';
|
||||
import { of } from 'rxjs';
|
||||
import { Project } from '@app/domain/projects/project.model';
|
||||
import { ProjectRepository } from '@app/domain/projects/project.repository';
|
||||
|
||||
describe('ProjectPictureFormComponent', () => {
|
||||
let component: ProjectPictureFormComponent;
|
||||
@@ -11,6 +15,7 @@ describe('ProjectPictureFormComponent', () => {
|
||||
|
||||
let mockToastrService: Partial<ToastrService>;
|
||||
let mockAuthService: Partial<AuthService>;
|
||||
let mockProjectRepository: jest.Mocked<ProjectRepository>;
|
||||
|
||||
beforeEach(async () => {
|
||||
mockToastrService = {
|
||||
@@ -22,12 +27,20 @@ describe('ProjectPictureFormComponent', () => {
|
||||
updateUser: jest.fn(),
|
||||
};
|
||||
|
||||
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: [ProjectPictureFormComponent],
|
||||
providers: [
|
||||
provideRouter([]),
|
||||
{ provide: ToastrService, useValue: mockToastrService },
|
||||
{ provide: AuthService, useValue: mockAuthService },
|
||||
{ provide: PROJECT_REPOSITORY_TOKEN, useValue: mockProjectRepository },
|
||||
],
|
||||
}).compileComponents();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user