diff --git a/app/presenters/bill-runs/index-bill-runs.presenter.js b/app/presenters/bill-runs/index-bill-runs.presenter.js index c42b5065ee..94c3dad179 100644 --- a/app/presenters/bill-runs/index-bill-runs.presenter.js +++ b/app/presenters/bill-runs/index-bill-runs.presenter.js @@ -42,7 +42,7 @@ function go (billRuns) { numberOfBills, region: capitalize(region), scheme, - status, + status: status === 'cancel' ? 'cancelling' : status, total: formatMoney(netTotal, true), type: formatBillRunType(batchType, scheme, summer) } diff --git a/app/views/macros/bill-run-status-tag.njk b/app/views/macros/bill-run-status-tag.njk index 0317be8973..bc8616c9f3 100644 --- a/app/views/macros/bill-run-status-tag.njk +++ b/app/views/macros/bill-run-status-tag.njk @@ -11,6 +11,8 @@ {% set color = "govuk-tag--grey" %} {% elif status === 'cancel' %} {% set color = "govuk-tag--orange" %} + {% elif status === 'cancelling' %} + {% set color = "govuk-tag--orange" %} {% elif status === 'error' %} {% set color = "govuk-tag--red" %} {% else %} diff --git a/test/presenters/bill-runs/index.bill-runs.presenter.test.js b/test/presenters/bill-runs/index.bill-runs.presenter.test.js index e0f13a5d4e..a8fbebf68c 100644 --- a/test/presenters/bill-runs/index.bill-runs.presenter.test.js +++ b/test/presenters/bill-runs/index.bill-runs.presenter.test.js @@ -85,6 +85,29 @@ describe('Index Bill Runs presenter', () => { }) }) }) + + describe("the 'status' property", () => { + describe("when a bill run has the status 'cancel'", () => { + beforeEach(() => { + billRuns[0].status = 'cancel' + }) + + it("returns 'cancelling' for the status", () => { + const results = IndexBillRunsPresenter.go(billRuns) + + expect(results[0].status).to.equal('cancelling') + }) + }) + + describe("when a bill run has a status other than 'cancel'", () => { + it('returns whatever the bill run status was', () => { + const results = IndexBillRunsPresenter.go(billRuns) + + expect(results[0].status).to.equal(billRuns[0].status) + expect(results[1].status).to.equal(billRuns[1].status) + }) + }) + }) }) })