diff --git a/src/services/unit.service.js b/src/services/unit.service.js index 6bf7690..7780352 100644 --- a/src/services/unit.service.js +++ b/src/services/unit.service.js @@ -100,10 +100,13 @@ async function getUnit (acro, lang) { unitPath: dict.hierarchie, path: unitPath, terminal: dict.has_accreds, - ghost: dict.ghost, - address: dict.adresse.split('$').map((value) => value.trim()) - .filter((value) => value !== '') + ghost: dict.ghost }; + const address = dict.adresse.split('$').map((value) => value.trim()) + .filter((value) => value !== ''); + if (address.length > 0) { + unitFullDetails.address = address; + } if (dict.resp_sciper) { unitFullDetails.head = { sciper: dict.resp_sciper, diff --git a/tests/resources/cadidb/getUnit-ot.json b/tests/resources/cadidb/getUnit-ot.json index f78c6f6..359fb97 100644 --- a/tests/resources/cadidb/getUnit-ot.json +++ b/tests/resources/cadidb/getUnit-ot.json @@ -12,7 +12,7 @@ "resp_prenom_usuel": null, "url": "https://en.wikipedia.org/wiki/Star_Wars_original_trilogy", "faxes": "10121,0216910122", - "adresse": "EPFL OT $ Original trilogy Square $ Station 15 $ CH-1015 Lausanne $ $ ", + "adresse": " $ $ $ $ $ ", "cmpl_type": "F", "ghost": null, "has_accreds": null diff --git a/tests/resources/unit/unit-ot-en.json b/tests/resources/unit/unit-ot-en.json index ba45657..c4ed005 100644 --- a/tests/resources/unit/unit-ot-en.json +++ b/tests/resources/unit/unit-ot-en.json @@ -15,12 +15,6 @@ ], "terminal": null, "ghost": null, - "address": [ - "EPFL OT", - "Original trilogy Square", - "Station 15", - "CH-1015 Lausanne" - ], "faxes": ["+41 21 6910121", "+41 21 6910122"], "url": "https://en.wikipedia.org/wiki/Star_Wars_original_trilogy", "subunits": [ diff --git a/tests/resources/unit/unit-ot-fr.json b/tests/resources/unit/unit-ot-fr.json index ba45657..c4ed005 100644 --- a/tests/resources/unit/unit-ot-fr.json +++ b/tests/resources/unit/unit-ot-fr.json @@ -15,12 +15,6 @@ ], "terminal": null, "ghost": null, - "address": [ - "EPFL OT", - "Original trilogy Square", - "Station 15", - "CH-1015 Lausanne" - ], "faxes": ["+41 21 6910121", "+41 21 6910122"], "url": "https://en.wikipedia.org/wiki/Star_Wars_original_trilogy", "subunits": [