diff --git a/src/eq_schema/builders/routing2/newRoutingDestination/index.js b/src/eq_schema/builders/routing2/newRoutingDestination/index.js index 60f1759e..73ce773c 100644 --- a/src/eq_schema/builders/routing2/newRoutingDestination/index.js +++ b/src/eq_schema/builders/routing2/newRoutingDestination/index.js @@ -22,7 +22,7 @@ const getOptionsFromQuestionaire = (questionnaire) => { const getOptionValues = (optionIds, questionnaire) => { const options = getOptionsFromQuestionaire(questionnaire); - const optionResults = optionIds.map((id) => filter(options, { id })[0].label); + const optionResults = optionIds.map((id) => filter(options, { id })[0].label.replace(/\s+$/, '')); if (optionResults === undefined || optionResults.length < 0) { return null; diff --git a/src/eq_schema/schema/Answer/index.js b/src/eq_schema/schema/Answer/index.js index 3da69770..004df696 100644 --- a/src/eq_schema/schema/Answer/index.js +++ b/src/eq_schema/schema/Answer/index.js @@ -265,7 +265,7 @@ class Answer { id: `answer${additionalAnswer.id}`, mandatory: properties.required, }; - + option.detail_answer.label = option.detail_answer.label.replace(/\s+$/, ''); if (ctx.questionnaireJson.dataVersion !== "3") { if (additionalAnswer.qCode && type !== "Checkbox") { option.detail_answer.q_code = additionalAnswer.qCode.replace(/\s+$/, ''); diff --git a/src/eq_schema/schema/Question/index.test.js b/src/eq_schema/schema/Question/index.test.js index 4e7c0ead..81d2e8b0 100644 --- a/src/eq_schema/schema/Question/index.test.js +++ b/src/eq_schema/schema/Question/index.test.js @@ -426,6 +426,7 @@ describe("Question", () => { additionalAnswer: { id: "3", type: "TextField", + label: "please describe", properties: { required: true }, }, },