Commit 01c08dbe authored by Jérémy Destin's avatar Jérémy Destin

fix: Work on tests. GNP-5097

parent ca68cb76
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { GenealogicTreeComponent } from './genealogic-tree.component';
import {
GenealogicTreeComponent,
GenealogicTreeFactory
} from './genealogic-tree.component';
import { CropOntologyWidgetFactory } from '../form/trait-ontology-widget/trait-ontology-widget.component';
describe('GenealogicTreeComponent', () => {
let component: GenealogicTreeComponent;
let fixture: ComponentFixture<GenealogicTreeComponent>;
// TODO create complete GenealogicTreeobject
const fakeGenealogicTree = {};
beforeEach(async(() => {
/*beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [GenealogicTreeComponent]
})
......@@ -17,9 +23,27 @@ describe('GenealogicTreeComponent', () => {
fixture = TestBed.createComponent(GenealogicTreeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
});*/
const fakeFactory: GenealogicTreeFactory = {
initialize() {
return fakeGenealogicTree;
}
};
beforeEach(() => TestBed.configureTestingModule({
declarations: [GenealogicTreeComponent],
providers: [
{ provide: GenealogicTreeComponent, useValue: fakeFactory }
]
}));
it('should create', () => {
const fixture = TestBed.createComponent(GenealogicTreeComponent);
const component = fixture.componentInstance;
fixture.detectChanges();
expect(component).toBeTruthy();
});
});
......
import { Component, Input, OnInit } from '@angular/core';
import BrAPI from '@solgenomics/brapijs';
import PedigreeViewer from '@solgenomics/brapi-pedigree-viewer';
import GenealogicTree from '@solgenomics/brapi-pedigree-viewer/build/PedigreeViewer.js'
export class GenealogicTreeFactory {
initialize(...args): GenealogicTree {
return new GenealogicTree(...args);
}
}
@Component({
selector: 'faidare-genealogic-tree',
......
......@@ -17,7 +17,7 @@ import { MapComponent } from '../map/map.component';
import { BrapiGermplasmAttributes, BrapiGermplasmPedigree, BrapiResult, BrapiSibling } from '../models/brapi.model';
import { Donor, Germplasm, GermplasmInstitute, GermplasmSet, Institute, Site } from '../models/gnpis.model';
import { DataDiscoverySource } from '../models/data-discovery.model';
import { MockComponent } from 'ng-mocks';
import { MockComponent, MockComponents } from 'ng-mocks';
import { XrefsComponent } from '../xrefs/xrefs.component';
import { CardGenericDocumentComponent } from '../card-generic-document/card-generic-document.component';
import { GenealogicTreeComponent } from '../genealogic-tree/genealogic-tree.component';
......@@ -225,9 +225,9 @@ describe('GermplasmCardComponent', () => {
TestBed.configureTestingModule({
imports: [RouterTestingModule, NgbPopoverModule, MomentModule],
declarations: [
GermplasmCardComponent, LoadingSpinnerComponent, MockComponent(XrefsComponent), CardSectionComponent,
GermplasmCardComponent, LoadingSpinnerComponent, MockComponents(XrefsComponent), CardSectionComponent,
CardRowComponent, LoadingSpinnerComponent, CardTableComponent,
MapComponent, MockComponent(CardGenericDocumentComponent), MockComponent(GenealogicTreeComponent)
MapComponent, MockComponents(CardGenericDocumentComponent), MockComponents(GenealogicTreeComponent)
],
providers: [
{ provide: BrapiService, useValue: brapiService },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment