Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
urgi-is
FAIDARE
Commits
bdd2430f
Commit
bdd2430f
authored
Apr 09, 2021
by
Jeremy Destin
Committed by
Célia Michotey
Aug 20, 2021
Browse files
Test: Add tests on mcpd.
parent
a3697d9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
frontend/src/app/brapi.service.spec.ts
View file @
bdd2430f
import
{
BrapiService
}
from
'
./brapi.service
'
;
import
{
BrapiCollectingSite
,
BrapiContacts
,
BrapiGermplasm
,
BrapiGermplasmAttributes
,
BrapiGermplasmMcpd
,
BrapiGermplasmPedigree
,
BrapiGermplasmProgeny
,
BrapiInstitute
,
BrapiLocation
,
BrapiObservationVariable
,
BrapiProgeny
,
...
...
@@ -14,9 +17,19 @@ import {
BrapiStudy
,
BrapiTrial
}
from
'
./models/brapi.model
'
;
import
{
HttpClientTestingModule
,
HttpTestingController
}
from
'
@angular/common/http/testing
'
;
import
{
HttpClientTestingModule
,
HttpTestingController
}
from
'
@angular/common/http/testing
'
;
import
{
TestBed
}
from
'
@angular/core/testing
'
;
import
{
Donor
,
Germplasm
,
GermplasmInstitute
,
GermplasmSet
,
Institute
,
Site
}
from
'
./models/gnpis.model
'
;
import
{
Donor
,
Germplasm
,
GermplasmInstitute
,
GermplasmSet
,
Institute
,
Site
}
from
'
./models/gnpis.model
'
;
describe
(
'
BrapiService
'
,
()
=>
{
...
...
@@ -214,6 +227,16 @@ describe('BrapiService', () => {
address
:
'
12
'
,
logo
:
null
};
const
brapiInstitute
:
BrapiInstitute
=
{
instituteName
:
'
INRAE URGI
'
,
instituteCode
:
'
78000
'
,
acronym
:
'
INRAE
'
,
organisation
:
'
inrae
'
,
instituteType
:
'
lab
'
,
webSite
:
'
www.labo.fr
'
,
instituteAddress
:
'
18
'
,
logo
:
null
};
const
origin
:
GermplasmInstitute
=
{
...
institute
,
institute
:
institute
,
...
...
@@ -226,6 +249,20 @@ describe('BrapiService', () => {
distributionStatus
:
null
};
const
collectingSite
:
BrapiCollectingSite
=
{
locationDbId
:
'
FR-78-INRAE
'
,
locationName
:
'
Versailles
'
,
coordinateUncertainty
:
null
,
elevation
:
null
,
georeferencingMethod
:
null
,
latitudeDecimal
:
null
,
latitudeDegrees
:
null
,
locationDescription
:
null
,
longitudeDecimal
:
null
,
longitudeDegrees
:
null
,
spatialReferenceSystem
:
null
,
};
const
brapiDonor
:
Donor
=
{
donorInstitute
:
institute
,
donorGermplasmPUI
:
'
12
'
,
...
...
@@ -303,6 +340,62 @@ describe('BrapiService', () => {
'
schema:includedInDataCatalog
'
:
null
};
const
germplasmMcpdTest
:
BrapiGermplasmMcpd
=
{
groupId
:
'
0
'
,
accessionNames
:
[
'
test accession
'
],
accessionNumber
:
'
01
'
,
acquisitionDate
:
'
2021
'
,
acquisitionSourceCode
:
'
FR-urgi
'
,
alternateIDs
:
[
'
Id1
'
,
'
Id2
'
],
ancestralData
:
null
,
biologicalStatusOfAccessionCode
:
'
maintained
'
,
breedingInstitutes
:
brapiInstitute
,
collectingInfo
:
{
collectingDate
:
'
2021
'
,
collectingInstitutes
:
brapiInstitute
,
collectingMissionIdentifier
:
'
007
'
,
collectingNumber
:
'
3
'
,
collectors
:
'
urgi
'
,
materialType
:
'
germplasm
'
,
collectingSite
:
collectingSite
,
},
commonCropName
:
'
wheat
'
,
countryOfOriginCode
:
'
FR
'
,
donorInfo
:
{
donorAccessionNumber
:
'
ING007
'
,
donorInstitute
:
brapiInstitute
,
donationDate
:
'
2021
'
,
},
genus
:
'
Triti
'
,
germplasmDbId
:
'
Fr-007
'
,
germplasmPUI
:
'
urn/fr-007
'
,
instituteCode
:
'
FR-INRAE
'
,
mlsStatus
:
'
0
'
,
remarks
:
null
,
safetyDuplicateInstitutes
:
null
,
species
:
'
Triti
'
,
speciesAuthority
:
null
,
storageTypeCodes
:
null
,
subtaxon
:
null
,
subtaxonAuthority
:
null
,
breederAccessionNumber
:
null
,
breedingCreationYear
:
null
,
catalogRegistrationYear
:
null
,
catalogDeregistrationYear
:
null
,
originLocationDbId
:
'
FR-Ver
'
,
originLocationName
:
'
Versailles
'
,
holdingInstitute
:
brapiInstitute
,
holdingGenbank
:
brapiInstitute
,
geneticNature
:
'
hybrid
'
,
presenceStatus
:
null
,
distributorInfos
:
null
};
const
germplasmMcpdTestResult
:
BrapiResult
<
BrapiGermplasmMcpd
>
=
{
metadata
:
null
,
result
:
germplasmMcpdTest
};
let
brapiService
:
BrapiService
;
let
http
:
HttpTestingController
;
...
...
@@ -428,4 +521,18 @@ describe('BrapiService', () => {
});
it
(
'
should fetch the germplasm mcpd
'
,
()
=>
{
let
fetchedGermplasmMcpd
:
BrapiResult
<
BrapiGermplasmMcpd
>
;
const
germplasmDbId
:
string
=
germplasmTest
.
germplasmDbId
;
brapiService
.
germplasmMcpd
(
germplasmDbId
).
subscribe
(
response
=>
{
fetchedGermplasmMcpd
=
response
;
});
http
.
expectOne
(
`brapi/v1/germplasm/
${
germplasmDbId
}
/mcpd`
)
.
flush
(
germplasmMcpdTestResult
);
expect
(
fetchedGermplasmMcpd
).
toEqual
(
germplasmMcpdTestResult
);
});
});
frontend/src/app/germplasm-card/germplasm-card.component.spec.ts
View file @
bdd2430f
...
...
@@ -52,6 +52,14 @@ describe('GermplasmCardComponent', () => {
get
cardHeader
()
{
return
this
.
elements
(
'
div.card-header
'
);
}
get
cardRowField
()
{
return
this
.
elements
(
'
div.field
'
);
}
get
cardRowValue
()
{
return
this
.
elements
(
'
div.value
'
);
}
}
const
brapiSibling
:
BrapiSibling
=
{
...
...
@@ -177,7 +185,7 @@ describe('GermplasmCardComponent', () => {
germplasmDbId
:
'
test
'
,
defaultDisplayName
:
'
test
'
,
accessionNumber
:
'
test
'
,
germplasmName
:
'
test
'
,
germplasmName
:
'
test
Name
'
,
germplasmPUI
:
'
doi:1256
'
,
pedigree
:
'
tree
'
,
seedSource
:
'
inra
'
,
...
...
@@ -270,6 +278,10 @@ describe('GermplasmCardComponent', () => {
presenceStatus
:
null
,
distributorInfos
:
null
};
const
germplasmMcpdTestResult
:
BrapiResult
<
BrapiGermplasmMcpd
>
=
{
metadata
:
null
,
result
:
germplasmMcpdTest
};
const
gnpisService
=
jasmine
.
createSpyObj
(
'
GnpisService
'
,
[
...
...
@@ -291,7 +303,7 @@ describe('GermplasmCardComponent', () => {
// brapiService.germplasmProgeny.and.returnValue(of(brapiGermplasmProgeny));
brapiService
.
germplasmPedigree
.
and
.
returnValue
(
of
(
brapiGermplasmPedigree
));
brapiService
.
germplasmAttributes
.
and
.
returnValue
(
of
(
brapiGermplasmAttributes
));
brapiService
.
germplasmMcpd
.
and
.
returnValue
(
of
(
germplasmMcpdTest
));
brapiService
.
germplasmMcpd
.
and
.
returnValue
(
of
(
germplasmMcpdTest
Result
));
const
activatedRouteParams
=
{
...
...
@@ -328,15 +340,22 @@ describe('GermplasmCardComponent', () => {
component
.
loaded
.
then
(()
=>
{
expect
(
component
.
germplasmGnpis
).
toBeTruthy
();
expect
(
component
.
germplasmMcpd
).
toBeTruthy
();
tester
.
detectChanges
();
expect
(
tester
.
title
).
toContainText
(
'
Germplasm: test
'
);
expect
(
tester
.
cardHeader
[
0
]).
toContainText
(
'
Identification
'
);
expect
(
tester
.
cardRowField
[
0
]).
toContainText
(
'
Germplasm name
'
);
expect
(
tester
.
cardRowValue
[
0
]).
toContainText
(
'
testName
'
);
expect
(
tester
.
cardHeader
[
1
]).
toContainText
(
'
Depositary
'
);
expect
(
tester
.
cardHeader
[
2
]).
toContainText
(
'
Collector
'
);
expect
(
tester
.
cardHeader
[
3
]).
toContainText
(
'
Breeder
'
);
expect
(
tester
.
cardHeader
[
4
]).
toContainText
(
'
Donor
'
);
expect
(
tester
.
cardHeader
[
5
]).
toContainText
(
'
Distributor
'
);
expect
(
tester
.
cardHeader
[
6
]).
toContainText
(
'
Evaluation Data
'
);
expect
(
tester
.
cardRowField
[
5
]).
toContainText
(
'
MLS status
'
);
expect
(
tester
.
cardRowValue
[
5
]).
toContainText
(
'
0
'
);
});
}));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment