Skip to content

Commit

Permalink
Tests with correct ldap
Browse files Browse the repository at this point in the history
  • Loading branch information
williambelle committed Oct 30, 2023
1 parent 71fe502 commit beee598
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 13 deletions.
5 changes: 4 additions & 1 deletion src/services/unit.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ async function getUnit (acro, lang) {
}
if (dict.has_accreds) {
const ldapUnitPersons = await peopleService.getPersonByUnit(dict.sigle);
unitFullDetails.people = ldapUtil.ldap2unit(ldapUnitPersons, lang);
const UnitPersons = ldapUtil.ldap2unit(ldapUnitPersons, lang);
if (UnitPersons.length > 0) {
unitFullDetails.people = UnitPersons;
}
} else {
unitFullDetails.subunits = await getSubunits(dict.id_unite, lang);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/resources/cadidb/getUnit-mandalore.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"libelle": "Mandalore est une planète située dans les territoires de la bordure extérieure de la galaxie.",
"libelle_en": "",
"hierarchie": "EPFL SO TV-3 MANDALORE",
"resp_sciper": "670005",
"resp_nom": "Grogu",
"resp_sciper": "670003",
"resp_nom": "Djarin",
"resp_nom_usuel": null,
"resp_prenom": "Din",
"resp_prenom_usuel": null,
Expand Down
33 changes: 28 additions & 5 deletions tests/resources/unit/unit-mandalore-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,34 @@
"CH-1015 Lausanne"
],
"head": {
"sciper": "670005",
"name": "Grogu",
"sciper": "670003",
"name": "Djarin",
"firstname": "Din",
"email": "din.grogu@epfl.ch",
"profile": "din.grogu"
"email": "din.djarin@epfl.ch",
"profile": "din.djarin"
},
"people": []
"people": [
{
"email": "[email protected]",
"firstname": "Din",
"name": "Djarin",
"officeList": ["Sundari 231"],
"phoneList": ["+41 21 0054321"],
"position": "Bounty hunter",
"profile": "din.djarin",
"rank": 0,
"sciper": "670003"
},
{
"email": "[email protected]",
"firstname": "Paz",
"name": "Vizsla",
"officeList": ["Ronion 001"],
"phoneList": ["+41 21 0654321"],
"position": "Heavy infantry",
"profile": "paz.vizsla",
"rank": 0,
"sciper": "670004"
}
]
}
33 changes: 28 additions & 5 deletions tests/resources/unit/unit-mandalore-fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,34 @@
"CH-1015 Lausanne"
],
"head": {
"sciper": "670005",
"name": "Grogu",
"sciper": "670003",
"name": "Djarin",
"firstname": "Din",
"email": "din.grogu@epfl.ch",
"profile": "din.grogu"
"email": "din.djarin@epfl.ch",
"profile": "din.djarin"
},
"people": []
"people": [
{
"email": "[email protected]",
"firstname": "Din",
"name": "Djarin",
"officeList": ["Sundari 231"],
"phoneList": ["+41 21 0054321"],
"position": "Chasseur de prime",
"profile": "din.djarin",
"rank": 0,
"sciper": "670003"
},
{
"email": "[email protected]",
"firstname": "Paz",
"name": "Vizsla",
"officeList": ["Ronion 001"],
"phoneList": ["+41 21 0654321"],
"position": "Infanterie lourde",
"profile": "paz.vizsla",
"rank": 0,
"sciper": "670004"
}
]
}

0 comments on commit beee598

Please sign in to comment.