Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bill run status badge in bill runs page #945

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/presenters/bill-runs/index-bill-runs.presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 2 additions & 0 deletions app/views/macros/bill-run-status-tag.njk
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
23 changes: 23 additions & 0 deletions test/presenters/bill-runs/index.bill-runs.presenter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})
})
})
})

Expand Down
Loading