Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 32 additions & 23 deletions apps/api/__tests__/__helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,28 +116,6 @@ function assertValidScientificName(scientificName) {
expect(scientificName).toMatch(/^[A-Z][a-z]+ [a-z]+$/) // Genus species format
}

/**
* Assert that conservation status is valid
*/
function assertValidConservationStatus(status) {
const validStatuses = [
'Least Concern',
'Near Threatened',
'Vulnerable',
'Endangered',
'Critically Endangered',
'Extinct in the Wild',
'Extinct',
'Data Deficient',
'Not Evaluated',
'Not Applicable',
]

if (status && status !== 'No') {
expect(validStatuses).toContain(status)
}
}

/**
* Test data validation helpers
*/
Expand All @@ -158,6 +136,11 @@ const testData = {
"Aeshna viridis",
"Agriocnemis pygmaea",
"Agriocnemis sania",
"Arabicnemis caerulea",
"Arabineura khalidi",
"Azuragrion nigridorsum",
"Azuragrion somalicum",
"Azuragrion vansomereni",
"Anax ephippiger",
"Anax immaculifrons",
"Anax imperator",
Expand All @@ -176,11 +159,14 @@ const testData = {
"Calopteryx virgo",
"Calopteryx xanthostoma",
"Ceriagrion georgifreyi",
"Ceriagrion glabrum",
"Ceriagrion tenellum",
"Chalcolestes parvidens",
"Chalcolestes viridis",
"Coenagrion armatum",
"Coenagrion australocaspicum",
"Coenagrion caerulescens",
"Coenagrion castellani",
"Coenagrion ecornutum",
"Coenagrion glaciale",
"Coenagrion hastulatum",
Expand All @@ -190,9 +176,12 @@ const testData = {
"Coenagrion lunulatum",
"Coenagrion mercuriale",
"Coenagrion ornatum",
"Coenagrion persicum",
"Coenagrion ponticum",
"Coenagrion puella",
"Coenagrion pulchellum",
"Coenagrion scitulum",
"Coenagrion syriacum",
"Cordulegaster boltonii",
"Cordulegaster heros",
"Cordulegaster picta",
Expand All @@ -204,6 +193,7 @@ const testData = {
"Crocothemis erythraea",
"Diplacodes lefebvrii",
"Enallagma cyathigerum",
"Enallagma risi",
"Epallage fatima",
"Epitheca bimaculata",
"Erythromma lindenii",
Expand All @@ -216,12 +206,16 @@ const testData = {
"Gomphus vulgatissimus",
"Ischnura aralensis",
"Ischnura elegans",
"Ischnura evansi",
"Ischnura forcipata",
"Ischnura fountaineae",
"Ischnura genei",
"Ischnura graellsii",
"Ischnura hastata",
"Ischnura intermedia",
"Ischnura nursei",
"Ischnura pumilio",
"Ischnura rubilio",
"Ischnura saharensis",
"Ischnura senegalensis",
"Isoaeshna isoceles",
Expand Down Expand Up @@ -264,8 +258,20 @@ const testData = {
"Paragomphus genei",
"Platycnemis acutipennis",
"Platycnemis dealbata",
"Platycnemis kervillei",
"Platycnemis latipes",
"Platycnemis pennipes",
"Platycnemis subdilatata",
"Pseudagrion arabicum",
"Pseudagrion decorum",
"Pseudagrion hamoni",
"Pseudagrion kersteni",
"Pseudagrion laidlawi",
"Pseudagrion niloticum",
"Pseudagrion nubicum",
"Pseudagrion sublacteum",
"Pseudagrion syriacum",
"Pseudagrion torridum",
"Pyrrhosoma elisabethae",
"Pyrrhosoma nymphula",
"Selysiothemis nigra",
Expand Down Expand Up @@ -316,6 +322,9 @@ const testData = {
'Aeshna',
'Agriocnemis',
'Anax',
'Arabicnemis',
'Arabineura',
'Azuragrion',
'Boyeria',
'Brachythemis',
'Brachytron',
Expand Down Expand Up @@ -348,6 +357,7 @@ const testData = {
'Pantala',
'Paragomphus',
'Platycnemis',
'Pseudagrion',
'Pyrrhosoma',
'Selysiothemis',
'Somatochlora',
Expand Down Expand Up @@ -378,6 +388,5 @@ module.exports = {
assertHasErrors,
assertSpeciesArray,
assertValidScientificName,
assertValidConservationStatus,
testData
}
5 changes: 2 additions & 3 deletions apps/api/__tests__/integration.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ const {
GET_SPECIES_BY_GENUS_QUERY
} = require('./__queries')
const {
assertNoErrors,
assertNoErrors,
assertSpeciesArray,
assertValidScientificName,
assertValidConservationStatus,
testData
testData
} = require('./__helpers')

describe('Integration Tests - Complex Scenarios', () => {
Expand Down
9 changes: 7 additions & 2 deletions apps/api/_data/families/aeshnidae/about.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
"title": "Aeshnidae",
"author_citation": "Rambur, 1842",
"description": "The **_Aeshnidae_**, also called **aeshnids**, **hawkers**, or **darners**, is a family of dragonflies. The family includes the largest dragonflies found in Europe and North America and among the largest dragonflies on the planet.\n\n### Description\nCommon worldwide or nearly worldwide. Genera are *Aeshna* and *Anax*. The African *Anax tristis* has a wingspan over 125 mm, making it one of the world's largest known dragonflies. Most European species belong to *Aeshna*. Their American name *darner* stems from the female abdomens looking like a sewing needle, as they cut into plant stem when they lay their eggs.\n\nThe dragonflies mate in flight. The eggs are deposited in water or close by. The larvae (nymphs or naiads) are generally slender compared to those of other families, with a long and flat extensible lower lip (labium). The larvae are aquatic predators, feeding on other insects and even small fish.\n\nThe adults spend large amounts of time in the air and seem to fly tirelessly. They can fly forwards or backwards or hover like a helicopter. The wings are always extended horizontally.\n\nThe abdomen are mostly colored blue and or green, with black and occasionally yellow. The large, hemispherical, compound eyes touch in the midline. Individuals of this family have an extremely good sight, and are voracious insect predators.\n\nA proposal has been made to split this family into Aeshnidae and Telephlebiidae.\n\nThe name may have resulted from a printer's error in spelling the Greek Aechma, *a spear*. The spelling Aeschnidae has been intermittently used over a period of time, but is now abandoned for the original name Aeshnidae. However, derived genus names (such as Rhionaeschna) retain the 'sch' spelling, as this is how they were first cited.",
"sources": ["[Wikipedia](https://en.wikipedia.org/wiki/Aeshnidae)"],
"sources": [
"[Wikipedia](https://en.wikipedia.org/wiki/Aeshnidae)"
],
"links": [
{ "label": "gbif.org", "link": "https://www.gbif.org/species/4209" }
{
"label": "gbif.org",
"link": "https://www.gbif.org/species/4209"
}
],
"meta": [
{
Expand Down
5 changes: 4 additions & 1 deletion apps/api/_data/families/aeshnidae/aeshna/about.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"Field guide to the dragonflies of Britain and Europe, Klaas-Douwe B Dijkstra."
],
"links": [
{ "label": "gbif.org", "link": "https://www.gbif.org/species/1425165" }
{
"label": "gbif.org",
"link": "https://www.gbif.org/species/1425165"
}
],
"meta": [
{
Expand Down
5 changes: 4 additions & 1 deletion apps/api/_data/families/aeshnidae/anax/about.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"Field guide to the dragonflies of Britain and Europe, Klaas-Douwe B Dijkstra."
],
"links": [
{ "label": "gbif.org", "link": "https://www.gbif.org/species/1424815" }
{
"label": "gbif.org",
"link": "https://www.gbif.org/species/1424815"
}
],
"meta": [
{
Expand Down
5 changes: 4 additions & 1 deletion apps/api/_data/families/aeshnidae/boyeria/about.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"Field guide to the dragonflies of Britain and Europe, Klaas-Douwe B Dijkstra."
],
"links": [
{ "label": "gbif.org", "link": "https://www.gbif.org/species/1425135" }
{
"label": "gbif.org",
"link": "https://www.gbif.org/species/1425135"
}
],
"meta": [
{
Expand Down
9 changes: 7 additions & 2 deletions apps/api/_data/families/aeshnidae/brachytron/about.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
"title": "Brachytron",
"author_citation": "Evans, 1845",
"description": "**_Brachytron_** is a monotypic genus of European dragonfly of the family Aeshnidae containing only *Brachytron pratense*, the hairy dragonfly, also known as the hairy hawker or spring hawker.",
"sources": ["[Wikipedia](https://en.wikipedia.org/wiki/Hairy_dragonfly)"],
"sources": [
"[Wikipedia](https://en.wikipedia.org/wiki/Hairy_dragonfly)"
],
"links": [
{ "label": "gbif.org", "link": "https://www.gbif.org/species/6757466" }
{
"label": "gbif.org",
"link": "https://www.gbif.org/species/6757466"
}
],
"meta": [
{
Expand Down
9 changes: 7 additions & 2 deletions apps/api/_data/families/aeshnidae/caliaeschna/about.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
"title": "Caliaeschna",
"author_citation": "Schneider, 1845",
"description": "**_Caliaeschna_** is a monotypic genus of European dragonfly of the family Aeshnidae containing only *Caliaeschna microstigma*, the Eastern spectre.",
"sources": ["[GBIF](https://www.gbif.org/species/1425326)"],
"sources": [
"[GBIF](https://www.gbif.org/species/1425326)"
],
"links": [
{ "label": "gbif.org", "link": "https://www.gbif.org/species/1425326" }
{
"label": "gbif.org",
"link": "https://www.gbif.org/species/1425326"
}
],
"meta": [
{
Expand Down
5 changes: 4 additions & 1 deletion apps/api/_data/families/calopterygidae/about.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
"Field guide to the dragonflies of Britain and Europe, Klaas-Douwe B Dijkstra."
],
"links": [
{ "label": "gbif.org", "link": "https://www.gbif.org/species/4211" }
{
"label": "gbif.org",
"link": "https://www.gbif.org/species/4211"
}
],
"meta": [
{
Expand Down
5 changes: 4 additions & 1 deletion apps/api/_data/families/calopterygidae/calopteryx/about.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
"Field guide to the dragonflies of Britain and Europe, Klaas-Douwe B Dijkstra."
],
"links": [
{ "label": "gbif.org", "link": "https://www.gbif.org/species/1427007" }
{
"label": "gbif.org",
"link": "https://www.gbif.org/species/1427007"
}
],
"meta": [
{
Expand Down
9 changes: 7 additions & 2 deletions apps/api/_data/families/coenagrionidae/about.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
"title": " Coenagrionidae",
"author_citation": "Kirby, 1890",
"description": "The insect family **Coenagrionidae** is placed in the order Odonata and the suborder Zygoptera. The Zygoptera are the damselflies, which although less known than the dragonflies, are no less common. More than 1,300 species are in this family, making it the largest damselfly family. The family Coenagrionidae has six subfamilies: Agriocnemidinae, Argiinae, Coenagrioninae, Ischnurinae, Leptobasinae, and Pseudagrioninae.\n\nThis family is referred to as the **narrow-winged damselflies** or the **pond damselflies**. The Coenagrionidae enjoy a worldwide distribution, and are among the most common of damselfly families. This family has the smallest of damselfly species. More than 110 genera of the family Coenagrionidae are currently accepted.\n\nThe family was named by [William Forsell Kirby](https://en.wikipedia.org/wiki/William_Forsell_Kirby) in 1890. The name may be derived from Greek *coen* meaning shared or common and *agrio* meaning fields or wild.",
"sources": ["[Wikipedia](https://en.wikipedia.org/wiki/Coenagrionidae)"],
"sources": [
"[Wikipedia](https://en.wikipedia.org/wiki/Coenagrionidae)"
],
"links": [
{ "label": "gbif.org", "link": "https://www.gbif.org/species/8577" }
{
"label": "gbif.org",
"link": "https://www.gbif.org/species/8577"
}
],
"meta": [
{
Expand Down
34 changes: 17 additions & 17 deletions apps/api/_data/families/coenagrionidae/agriocnemis/about.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"title": "Agriocnemis",
"author_citation": "Sélys, 1877",
"description": "**_Agriocnemis_** is a genus of damselfly in the family *coenagrioniade*. Agriocnemis is distributed widely across Africa, South-east Asia, Indonesia, Australia and islands in the Pacific. They are small insects, commonly known as wisps.",
"sources": [],
"links": [
{
"label": "gbif.org",
"link": "https://www.gbif.org/species/8285015"
}
],
"meta": [
{
"label": "gbifTaxonKey",
"value": "8285015"
}
]
}
"title": "Agriocnemis",
"author_citation": "Sélys, 1877",
"description": "**_Agriocnemis_** is a genus of damselfly in the family *coenagrioniade*. Agriocnemis is distributed widely across Africa, South-east Asia, Indonesia, Australia and islands in the Pacific. They are small insects, commonly known as wisps.",
"sources": [],
"links": [
{
"label": "gbif.org",
"link": "https://www.gbif.org/species/8285015"
}
],
"meta": [
{
"label": "gbifTaxonKey",
"value": "8285015"
}
]
}
20 changes: 20 additions & 0 deletions apps/api/_data/families/coenagrionidae/azuragrion/about.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"title": "Azuragrion",
"author_citation": "Fraser, 1949",
"description": "**_Azuragrion_** is a genus of damselflies in the family Coenagrionidae found in sub-Saharan Africa and the Arabian peninsula.",
"sources": [
"[Wikipedia](https://en.wikipedia.org/wiki/Azuragrion)"
],
"links": [
{
"label": "gbif.org",
"link": "https://www.gbif.org/species/1422591"
}
],
"meta": [
{
"label": "gbifTaxonKey",
"value": "1422450"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"items_id": "e0179331d0cef5afbc73d5ac66034e69",
"scientific_name": "Azuragrion nigridorsum",
"author_citation": "(Selys, 1876)",
"local_names": ["Sailing bluet", "Seglande azurflickslända"],
"description": "A small to medium-sized damselfly with blue and black coloration in males. The dorsal surface of the abdomen is largely black with blue markings at the segment bases. Females are typically greenish or brownish with black markings.",
"behaviour": "",
"size": {
"length": "",
"wingspan": ""
},
"similar_species": [],
"distribution": "*Azuragrion nigridorsum* occurs across sub-Saharan Africa, mainly from Kenya southwards, and extends into Ethiopia and the southern Arabian Peninsula. It occurs in Yemen, including Socotra island) and the Dhofar region in southern Oman.",
"habitat": "In the arabic peninsula it is known from about 35 localities, reached by the monsoon rains, where it occurs at temporary flowing wadis, irrigation channels and coastal lagoons. On Socotra island the species does not occur in fast-flowing streams, but can be seen on floating algae and grassy vegetation along slow flowing streams and in marshes.",
"flight_period": "",
"images": {
"cloud_name": "dragonflies",
"all": []
},
"sources": [
"Atlas of the Dragonflies and Damselflies of West and Central Asia, J.-P. Boudot, S. Borisov, G. De Knijf, R.H.A. van Grunsven, A. Schröter, V. J. Kalkman"
],
"links": [
{
"label": "iNaturalist.org",
"link": "https://www.inaturalist.org/taxa/95015-Azuragrion-nigridorsum"
},
{
"label": "gbif.org",
"link": "https://www.gbif.org/species/1422598"
}
],
"meta": [
{
"label": "gbifTaxonKey",
"value": "1422598"
}
]
}
Loading