Skip to content

Commit

Permalink
fix: prevent error when variable is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
fterra-encora committed Jan 8, 2025
1 parent 5c81047 commit 570c0fe
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 7 deletions.
16 changes: 9 additions & 7 deletions frontend/src/pages/ClientDetailsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,15 @@ const formatLocationsList = (
allLocations: ClientLocation[] = data.value.addresses,
) => {
const list: string[] = [];
for (const curLocationCode of locationCodes.toSorted()) {
const location = allLocations.find(
(curLocation) => curLocation.clientLocnCode === curLocationCode,
);
const title = formatLocation(location);
list.push(title);
if (Array.isArray(locationCodes)) {
for (const curLocationCode of locationCodes.toSorted()) {
const location = allLocations.find(
(curLocation) => curLocation.clientLocnCode === curLocationCode,
);
const title = formatLocation(location);
list.push(title);
}
}
return list.join(", ");
};
Expand Down
20 changes: 20 additions & 0 deletions frontend/stub/__files/response-clients-details-NL.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"registryCompanyTypeCode": "SP",
"corpRegnNmbr": "{{randomValue length=8 type='NUMERIC'}}",
"clientNumber":"{{randomValue length=4 type='NUMERIC'}}",
"clientName": "Scott",
"legalFirstName": "Michael",
"legalMiddleName": "",
"doingBusinessAs": [],
"birthdate": "1962-08-17",
"clientAcronym": "",
"clientTypeCode": "RSP",
"clientTypeDesc": "Registered sole proprietorship",
"goodStandingInd": "N",
"clientStatusCode": "A",
"clientStatusDesc": "Active",
"clientComment": "",
"wcbFirmNumber": "{{randomValue length=7 type='NUMERIC'}}",
"contacts": [],
"addresses": []
}
15 changes: 15 additions & 0 deletions frontend/stub/mappings/client_details.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@
"fixedDelayMilliseconds": 500
}
},
{
"name": "Client Details Individual - no locations",
"request": {
"urlPattern": "/api/clients/details/[nN][lL](.*)",
"method": "GET"
},
"response": {
"status": 200,
"bodyFileName": "response-clients-details-NL.json",
"transformers": [
"response-template"
],
"fixedDelayMilliseconds": 500
}
},
{
"name": "Client Details - Error 400",
"request": {
Expand Down

0 comments on commit 570c0fe

Please sign in to comment.