Fixed test

pull/24/head
Manuel Aranda Rosales 2025-06-02 08:29:21 +02:00
parent 6c7951be31
commit 62001e4a44
1 changed files with 39 additions and 2 deletions

View File

@ -1,16 +1,53 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ChangeParentComponent } from './change-parent.component';
import {ManageClientComponent} from "../clients/manage-client/manage-client.component";
import {HttpClientTestingModule} from "@angular/common/http/testing";
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
import {MAT_DIALOG_DATA, MatDialogModule, MatDialogRef} from "@angular/material/dialog";
import {MatSnackBarModule} from "@angular/material/snack-bar";
import {ToastrModule} from "ngx-toastr";
import {TranslateModule} from "@ngx-translate/core";
import {MatProgressSpinnerModule} from "@angular/material/progress-spinner";
import {ConfigService} from "@services/config.service";
import {DataService} from "../../services/data.service";
import {MatFormFieldModule} from "@angular/material/form-field";
import {MatSelectModule} from "@angular/material/select";
import {NoopAnimationsModule} from "@angular/platform-browser/animations";
describe('ChangeParentComponent', () => {
let component: ChangeParentComponent;
let fixture: ComponentFixture<ChangeParentComponent>;
beforeEach(async () => {
const mockConfigService = {
apiUrl: 'http://mock-api-url',
mercureUrl: 'http://mock-mercure-url'
};
await TestBed.configureTestingModule({
declarations: [ChangeParentComponent]
declarations: [ChangeParentComponent],
imports: [
HttpClientTestingModule,
ReactiveFormsModule,
MatDialogModule,
MatFormFieldModule,
MatSnackBarModule,
FormsModule ,
MatSelectModule ,
ToastrModule.forRoot(),
TranslateModule.forRoot(),
NoopAnimationsModule,
MatProgressSpinnerModule
],
providers: [
{ provide: MatDialogRef, useValue: {} },
{ provide: MAT_DIALOG_DATA, useValue: { data: { id: 123 } } },
{ provide: ConfigService, useValue: mockConfigService },
DataService
]
})
.compileComponents();
.compileComponents();
fixture = TestBed.createComponent(ChangeParentComponent);
component = fixture.componentInstance;