Skip to content
Snippets Groups Projects
Commit dad7b891 authored by Tifenn Guillas's avatar Tifenn Guillas
Browse files

Merge branch '5-add-tests-for-instance-search-module' into 'develop'

Clean code

Closes #5

See merge request !20
parents 063d8b9b 8a52e2b5
No related branches found
No related tags found
2 merge requests!29Develop,!20Clean code
Pipeline #6729 passed
Pipeline: anis-next

#6730

    ...@@ -2,8 +2,6 @@ import { Component, ViewChild } from '@angular/core'; ...@@ -2,8 +2,6 @@ import { Component, ViewChild } from '@angular/core';
    import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
    import { FormArray, FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormArray, FormsModule, ReactiveFormsModule } from '@angular/forms';
    import { NgSelectModule } from '@ng-select/ng-select';
    import { CheckboxComponent } from './checkbox.component'; import { CheckboxComponent } from './checkbox.component';
    import { SelectMultipleCriterion } from '../../../../store/models/criterion'; import { SelectMultipleCriterion } from '../../../../store/models/criterion';
    import { Option } from '../../../../../metamodel/models'; import { Option } from '../../../../../metamodel/models';
    ...@@ -14,7 +12,7 @@ describe('[Instance][Search][Component][Criteria][SearchType] CheckboxComponent' ...@@ -14,7 +12,7 @@ describe('[Instance][Search][Component][Criteria][SearchType] CheckboxComponent'
    @Component({ @Component({
    selector: `app-host`, selector: `app-host`,
    template: ` template: `
    <app-checkbox <app-checkbox
    [id]="id" [id]="id"
    [label]="label" [label]="label"
    [options]="options" [options]="options"
    ...@@ -41,7 +39,6 @@ describe('[Instance][Search][Component][Criteria][SearchType] CheckboxComponent' ...@@ -41,7 +39,6 @@ describe('[Instance][Search][Component][Criteria][SearchType] CheckboxComponent'
    TestHostComponent TestHostComponent
    ], ],
    imports: [ imports: [
    // NgSelectModule,
    FormsModule, FormsModule,
    ReactiveFormsModule ReactiveFormsModule
    ] ]
    ...@@ -56,18 +53,18 @@ describe('[Instance][Search][Component][Criteria][SearchType] CheckboxComponent' ...@@ -56,18 +53,18 @@ describe('[Instance][Search][Component][Criteria][SearchType] CheckboxComponent'
    expect(testedComponent).toBeTruthy(); expect(testedComponent).toBeTruthy();
    }); });
    it.only('should execute ngOnInit lifecycle', () => { // it('should execute ngOnInit lifecycle', () => {
    testedComponent.options = [ // testedComponent.options = [
    { label: 'One', value: 'one', display: 1 }, // { label: 'One', value: 'one', display: 1 },
    { label: 'Two', value: 'two', display: 2 }, // { label: 'Two', value: 'two', display: 2 },
    { label: 'Three', value: 'three', display: 3 } // { label: 'Three', value: 'three', display: 3 }
    ]; // ];
    testedComponent.ngOnInit(); // testedComponent.ngOnInit();
    console.log(testedComponent.options.length); // console.log(testedComponent.options.length);
    const formArray = testedComponent.form.controls.checkboxes as FormArray; // const formArray = testedComponent.form.controls.checkboxes as FormArray;
    // console.log(formArray.controls[0]); // // console.log(formArray.controls[0]);
    expect(testedComponent).toBeTruthy(); // expect(testedComponent).toBeTruthy();
    }); // });
    // it('should call ngOnChanges and apply changes', () => { // it('should call ngOnChanges and apply changes', () => {
    // const spy = jest.spyOn(testedComponent, 'ngOnChanges'); // const spy = jest.spyOn(testedComponent, 'ngOnChanges');
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment