Commit 09374a1e authored by Jérémy Destin's avatar Jérémy Destin Committed by Célia Michotey
Browse files

fix: Fix test for germplasm card. Increase cyclomatic complexity due to new...

fix: Fix test for germplasm card. Increase cyclomatic complexity due to new elements on germplasm page. GNP-5490
parent a6db1694
...@@ -16,10 +16,9 @@ import { ...@@ -16,10 +16,9 @@ import {
BrapiGermplasmAttributes, BrapiGermplasmAttributes,
BrapiGermplasmPedigree, BrapiGermplasmPedigree,
BrapiGermplasmProgeny, BrapiGermplasmProgeny,
BrapiSet,
BrapiSibling BrapiSibling
} from './models/brapi.germplasm.model'; } from './models/brapi.germplasm.model';
import { Germplasm, GermplasmData, GermplasmResult, Institute, Origin, Site } from './models/gnpis.germplasm.model'; import { Germplasm, GermplasmData, GermplasmResult, GermplasmSet, Institute, Origin, Site } from './models/gnpis.germplasm.model';
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
...@@ -212,7 +211,7 @@ describe('BrapiService', () => { ...@@ -212,7 +211,7 @@ describe('BrapiService', () => {
donationDate: null donationDate: null
}; };
const brapiSet: BrapiSet = { const germplasmSet: GermplasmSet = {
germplasmCount: 12, germplasmCount: 12,
germplasmRef: null, germplasmRef: null,
id: 12, id: 12,
...@@ -272,9 +271,9 @@ describe('BrapiService', () => { ...@@ -272,9 +271,9 @@ describe('BrapiService', () => {
collector: origin, collector: origin,
breeder: origin, breeder: origin,
distributors: [origin], distributors: [origin],
panel: [brapiSet], panel: [germplasmSet],
collection: [brapiSet], collection: [germplasmSet],
population: [brapiSet] population: [germplasmSet]
}; };
const germplasmResultTest = { const germplasmResultTest = {
......
...@@ -11,16 +11,16 @@ import { ...@@ -11,16 +11,16 @@ import {
BrapiDonor, BrapiDonor,
BrapiGermplasmAttributes, BrapiGermplasmAttributes,
BrapiGermplasmPedigree, BrapiGermplasmPedigree,
BrapiSet,
BrapiSibling BrapiSibling
} from '../models/brapi.germplasm.model'; } from '../models/brapi.germplasm.model';
import { Germplasm, GermplasmData, GermplasmResult, Institute, Origin, Site } from '../models/gnpis.germplasm.model'; import { Germplasm, GermplasmData, GermplasmResult, GermplasmSet, Institute, Origin, Site } from '../models/gnpis.germplasm.model';
import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'; import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap';
import { MomentModule } from 'ngx-moment'; import { MomentModule } from 'ngx-moment';
import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component'; import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component';
import { CardSectionComponent } from '../card-section/card-section.component'; import { CardSectionComponent } from '../card-section/card-section.component';
import { CardRowComponent } from '../card-row/card-row.component'; import { CardRowComponent } from '../card-row/card-row.component';
import { CardTableComponent } from '../card-table/card-table.component'; import { CardTableComponent } from '../card-table/card-table.component';
import { MapComponent } from '../map/map.component';
import { MockComponent } from 'ng-mocks'; import { MockComponent } from 'ng-mocks';
import { XrefsComponent } from '../xrefs/xrefs.component'; import { XrefsComponent } from '../xrefs/xrefs.component';
...@@ -135,7 +135,7 @@ describe('GermplasmCardComponent', () => { ...@@ -135,7 +135,7 @@ describe('GermplasmCardComponent', () => {
donationDate: null donationDate: null
}; };
const brapiSet: BrapiSet = { const germplasmSet: GermplasmSet = {
germplasmCount: 12, germplasmCount: 12,
germplasmRef: null, germplasmRef: null,
id: 12, id: 12,
...@@ -195,9 +195,9 @@ describe('GermplasmCardComponent', () => { ...@@ -195,9 +195,9 @@ describe('GermplasmCardComponent', () => {
collector: brapiOrigin, collector: brapiOrigin,
breeder: brapiOrigin, breeder: brapiOrigin,
distributors: [brapiOrigin], distributors: [brapiOrigin],
panel: [brapiSet], panel: [germplasmSet],
collection: [brapiSet], collection: [germplasmSet],
population: [brapiSet] population: [germplasmSet]
}; };
beforeEach(async(() => { beforeEach(async(() => {
...@@ -206,7 +206,7 @@ describe('GermplasmCardComponent', () => { ...@@ -206,7 +206,7 @@ describe('GermplasmCardComponent', () => {
declarations: [ declarations: [
GermplasmCardComponent, LoadingSpinnerComponent, MockComponent(XrefsComponent) GermplasmCardComponent, LoadingSpinnerComponent, MockComponent(XrefsComponent)
GermplasmCardComponent, CardSectionComponent, GermplasmCardComponent, CardSectionComponent,
CardRowComponent, LoadingSpinnerComponent, CardTableComponent CardRowComponent, LoadingSpinnerComponent, CardTableComponent, MapComponent
], ],
providers: [ providers: [
{ provide: BrapiService, useValue: brapiService }, { provide: BrapiService, useValue: brapiService },
...@@ -241,10 +241,11 @@ describe('GermplasmCardComponent', () => { ...@@ -241,10 +241,11 @@ describe('GermplasmCardComponent', () => {
expect(tester.title).toContainText('Germplasm: test'); expect(tester.title).toContainText('Germplasm: test');
expect(tester.cardHeader[0]).toContainText('Identification'); expect(tester.cardHeader[0]).toContainText('Identification');
expect(tester.cardHeader[1]).toContainText('Holding'); expect(tester.cardHeader[1]).toContainText('Holding');
expect(tester.cardHeader[2]).toContainText('Origin'); expect(tester.cardHeader[2]).toContainText('Collecting');
expect(tester.cardHeader[3]).toContainText('Distribution'); expect(tester.cardHeader[3]).toContainText('Breeder');
expect(tester.cardHeader[4]).toContainText('Genealogy'); expect(tester.cardHeader[4]).toContainText('Donation');
expect(tester.cardHeader[5]).toContainText('Evaluation Data'); expect(tester.cardHeader[5]).toContainText('Distribution');
expect(tester.cardHeader[6]).toContainText('Evaluation Data');
}); });
})); }));
}); });
......
import { Germplasm, Institute, Origin, Site } from './models/gnpis.germplasm.model'; import { Germplasm, GermplasmSet, Institute, Origin, Site } from './models/gnpis.germplasm.model';
import { BASE_URL, BASE_URL_GERMPLASM, GnpisService } from './gnpis.service'; import { BASE_URL, BASE_URL_GERMPLASM, GnpisService } from './gnpis.service';
import { BrapiMetaData, BrapiResults } from './models/brapi.model'; import { BrapiMetaData, BrapiResults } from './models/brapi.model';
import { DataDiscoveryCriteria, DataDiscoverySource } from './models/data-discovery.model'; import { DataDiscoveryCriteria, DataDiscoverySource } from './models/data-discovery.model';
import { BrapiDescriptor, BrapiDonor, BrapiSet } from './models/brapi.germplasm.model'; import { BrapiDescriptor, BrapiDonor } from './models/brapi.germplasm.model';
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
...@@ -29,7 +29,7 @@ describe('GnpisService', () => { ...@@ -29,7 +29,7 @@ describe('GnpisService', () => {
const site: Site = { const site: Site = {
latitude: null, latitude: null,
longitude: null, longitude: null,
siteId: 1, siteId: '1',
siteName: 'Nantes', siteName: 'Nantes',
siteType: null siteType: null
}; };
...@@ -71,7 +71,7 @@ describe('GnpisService', () => { ...@@ -71,7 +71,7 @@ describe('GnpisService', () => {
donationDate: null donationDate: null
}; };
const brapiSet: BrapiSet = { const germplasmSet: GermplasmSet = {
germplasmCount: 12, germplasmCount: 12,
germplasmRef: null, germplasmRef: null,
id: 12, id: 12,
...@@ -122,9 +122,9 @@ describe('GnpisService', () => { ...@@ -122,9 +122,9 @@ describe('GnpisService', () => {
collector: brapiOrigin, collector: brapiOrigin,
breeder: brapiOrigin, breeder: brapiOrigin,
distributors: [brapiOrigin], distributors: [brapiOrigin],
panel: [brapiSet], panel: [germplasmSet],
collection: [brapiSet], collection: [germplasmSet],
population: [brapiSet] population: [germplasmSet]
}; };
let gnpisService: GnpisService; let gnpisService: GnpisService;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
], ],
"template-cyclomatic-complexity": [ "template-cyclomatic-complexity": [
true, true,
12 18
] ]
} }
} }
Supports Markdown
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