diff --git a/app/presenters/bill-runs/two-part-tariff/review-licence.presenter.js b/app/presenters/bill-runs/two-part-tariff/review-licence.presenter.js index 1a5aacc231..4e9ecff126 100644 --- a/app/presenters/bill-runs/two-part-tariff/review-licence.presenter.js +++ b/app/presenters/bill-runs/two-part-tariff/review-licence.presenter.js @@ -249,7 +249,11 @@ function _prepareReturnVolume (reviewChargeElement) { if (reviewReturns) { reviewReturns.forEach((reviewReturn) => { - returnVolumes.push(`${reviewReturn.quantity} ML (${reviewReturn.returnReference})`) + if (reviewReturn.returnStatus === 'due') { + returnVolumes.push(`overdue (${reviewReturn.returnReference})`) + } else { + returnVolumes.push(`${reviewReturn.quantity} ML (${reviewReturn.returnReference})`) + } }) } diff --git a/test/presenters/bill-runs/two-part-tariff/review-licence.presenter.test.js b/test/presenters/bill-runs/two-part-tariff/review-licence.presenter.test.js index 186497d898..38951f7848 100644 --- a/test/presenters/bill-runs/two-part-tariff/review-licence.presenter.test.js +++ b/test/presenters/bill-runs/two-part-tariff/review-licence.presenter.test.js @@ -152,6 +152,7 @@ describe('Review Licence presenter', () => { describe('when a return has a status of "due"', () => { beforeEach(() => { licence[0].reviewReturns[0].returnStatus = 'due' + licence[0].reviewChargeVersions[0].reviewChargeReferences[0].reviewChargeElements[0].reviewReturns[0].returnStatus = 'due' }) it('changes the status text to "overdue"', () => { @@ -166,6 +167,12 @@ describe('Review Licence presenter', () => { expect(result.matchedReturns[0].returnTotal).to.equal('/') }) + it('formats the charge elements return total correctly', () => { + const result = ReviewLicencePresenter.go(billRun, licence) + + expect(result.chargeData[0].chargeReferences[0].chargeElements[0].returnVolume).to.equal(['overdue (10031343)']) + }) + it('formats the returns link correctly', () => { const result = ReviewLicencePresenter.go(billRun, licence)