diff --git a/frontend/src/app/GN2CommonModule/form/datasets/datasets.component.cy.ts b/frontend/src/app/GN2CommonModule/form/datasets/datasets.component.cy.ts new file mode 100644 index 0000000000..34d490a8fb --- /dev/null +++ b/frontend/src/app/GN2CommonModule/form/datasets/datasets.component.cy.ts @@ -0,0 +1,34 @@ +import { DatasetsComponent } from "./datasets.component" +import { + IterableDiffers, +} from '@angular/core'; +import { DataFormService } from "../data-form.service"; +import { EMPTY, Observable, from } from 'rxjs'; +import * as gerard from '../../GN2Common.module'; +import { UntypedFormControl } from "@angular/forms"; +export class DataFormServiceMock { + + constructor() { } + getDatasets(params, queryStrings = {}, fields = []) { + console.log("pouet") + return from([{ dataset_name: "test" }]) + } +} + +describe("Dataset Component", () => { + it("show component", () => { + cy.mount(DatasetsComponent, { + componentProperties: { + idAcquisitionFramework: 0, + displayOnlyActive: true, + parentFormControl: new UntypedFormControl() + }, + imports: [], + declarations: [DatasetsComponent], + providers: [ + IterableDiffers, + { provide: DataFormService, useClass: DataFormServiceMock } + ] + }) + }) +}) \ No newline at end of file diff --git a/frontend/src/app/GN2CommonModule/form/datasets/datasets.component.ts b/frontend/src/app/GN2CommonModule/form/datasets/datasets.component.ts index d91075c072..988710c1ed 100644 --- a/frontend/src/app/GN2CommonModule/form/datasets/datasets.component.ts +++ b/frontend/src/app/GN2CommonModule/form/datasets/datasets.component.ts @@ -9,9 +9,7 @@ import { } from '@angular/core'; import { DataFormService } from '../data-form.service'; import { GenericFormComponent } from '@geonature_common/form/genericForm.component'; -import { CommonService } from '../../service/common.service'; -import { ConfigService } from '@geonature/services/config.service'; -import { AbstractControl, Validators } from '@angular/forms'; +import { Validators } from '@angular/forms'; /** * Ce composant permet de créer un "input" de type "select" ou "multiselect" affichant l'ensemble des jeux de données sur lesquels l'utilisateur connecté a des droits (table ``gn_meta.t_datasets`` et ``gn_meta.cor_dataset_actor``) @@ -60,9 +58,7 @@ export class DatasetsComponent extends GenericFormComponent implements OnInit, O constructor( private _dfs: DataFormService, - private _commonService: CommonService, private _iterableDiffers: IterableDiffers, - public config: ConfigService ) { super(); this.iterableDiffer = this._iterableDiffers.find([]).create(null); @@ -70,6 +66,7 @@ export class DatasetsComponent extends GenericFormComponent implements OnInit, O ngOnInit() { this.bindValue = this.bindAllItem ? null : this.bindValue; + console.log("pouetpouet") this.getDatasets(); }