Skip to content

Commit

Permalink
Fix mark for supp billing page attributes (#1496)
Browse files Browse the repository at this point in the history
DEFRA/water-abstraction-acceptance-tests#144

As part of the work for the acceptance tests for supplementary billing flags, this PR introduces the necessary data-test attributes on the view page for the "Mark for Supplementary Billing" feature.
  • Loading branch information
Beckyrose200 authored Nov 19, 2024
1 parent 586b991 commit ee3639c
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 24 deletions.
2 changes: 1 addition & 1 deletion app/controllers/licences.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async function markedForSupplementaryBilling (request, h) {
const pageData = await MarkedForSupplementaryBillingService.go(licenceId)

return h.view('licences/marked-for-supplementary-billing.njk', {
pageTitle: 'Youve marked this licence for the next supplementary bill run',
pageTitle: "You've marked this licence for the next supplementary bill run",
activeNavBar: 'search',
...pageData
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,18 @@ function _yearsToDisplay () {
const year = currentFinancialYearEnd - i

if (year > LAST_PRE_SROC_FINANCIAL_YEAR_END) {
lastSixFinancialYears.push({ text: formatFinancialYear(year), value: year })
lastSixFinancialYears.push({
text: formatFinancialYear(year),
value: year,
attributes: { 'data-test': `sroc-years-${year}` }
})
} else {
lastSixFinancialYears.push({ text: 'Before 2022', value: 'preSroc', hint: { text: 'Old charge scheme' } })
lastSixFinancialYears.push({
text: 'Before 2022',
value: 'preSroc',
hint: { text: 'Old charge scheme' },
attributes: { 'data-test': 'pre-sroc-years' }
})

break
}
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/licences.controller.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ describe('Licences controller', () => {
const response = await server.inject(options)

expect(response.statusCode).to.equal(200)
expect(response.payload).to.contain('Youve marked this licence for the next supplementary bill run')
expect(response.payload).to.contain('You've marked this licence for the next supplementary bill run')
})
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ describe('Mark For Supplementary Billing presenter', () => {
licenceId: 'test-id',
licenceRef: '01/Test',
financialYears: [
{ text: '2023 to 2024', value: 2024 },
{ text: '2022 to 2023', value: 2023 },
{ text: 'Before 2022', value: 'preSroc', hint: { text: 'Old charge scheme' } }
{ text: '2023 to 2024', value: 2024, attributes: { 'data-test': 'sroc-years-2024' } },
{ text: '2022 to 2023', value: 2023, attributes: { 'data-test': 'sroc-years-2023' } },
{ text: 'Before 2022', value: 'preSroc', hint: { text: 'Old charge scheme' }, attributes: { 'data-test': 'pre-sroc-years' } }
]
})
})
Expand All @@ -75,10 +75,15 @@ describe('Mark For Supplementary Billing presenter', () => {
licenceId: 'test-id',
licenceRef: '01/Test',
financialYears: [
{ text: '2024 to 2025', value: 2025 },
{ text: '2023 to 2024', value: 2024 },
{ text: '2022 to 2023', value: 2023 },
{ text: 'Before 2022', value: 'preSroc', hint: { text: 'Old charge scheme' } }
{ text: '2024 to 2025', value: 2025, attributes: { 'data-test': 'sroc-years-2025' } },
{ text: '2023 to 2024', value: 2024, attributes: { 'data-test': 'sroc-years-2024' } },
{ text: '2022 to 2023', value: 2023, attributes: { 'data-test': 'sroc-years-2023' } },
{
text: 'Before 2022',
value: 'preSroc',
hint: { text: 'Old charge scheme' },
attributes: { 'data-test': 'pre-sroc-years' }
}
]
})
})
Expand All @@ -101,12 +106,12 @@ describe('Mark For Supplementary Billing presenter', () => {
licenceId: 'test-id',
licenceRef: '01/Test',
financialYears: [
{ text: '2027 to 2028', value: 2028 },
{ text: '2026 to 2027', value: 2027 },
{ text: '2025 to 2026', value: 2026 },
{ text: '2024 to 2025', value: 2025 },
{ text: '2023 to 2024', value: 2024 },
{ text: '2022 to 2023', value: 2023 }
{ text: '2027 to 2028', value: 2028, attributes: { 'data-test': 'sroc-years-2028' } },
{ text: '2026 to 2027', value: 2027, attributes: { 'data-test': 'sroc-years-2027' } },
{ text: '2025 to 2026', value: 2026, attributes: { 'data-test': 'sroc-years-2026' } },
{ text: '2024 to 2025', value: 2025, attributes: { 'data-test': 'sroc-years-2025' } },
{ text: '2023 to 2024', value: 2024, attributes: { 'data-test': 'sroc-years-2024' } },
{ text: '2022 to 2023', value: 2023, attributes: { 'data-test': 'sroc-years-2023' } }
]
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,15 @@ describe('Mark For Supplementary Billing Service', () => {
expect(result.licenceId).to.equal(licence.id)
expect(result.licenceRef).to.equal(licence.licenceRef)
expect(result.financialYears).to.equal([
{ text: '2024 to 2025', value: 2025 },
{ text: '2023 to 2024', value: 2024 },
{ text: '2022 to 2023', value: 2023 },
{ text: 'Before 2022', value: 'preSroc', hint: { text: 'Old charge scheme' } }
{ text: '2024 to 2025', value: 2025, attributes: { 'data-test': 'sroc-years-2025' } },
{ text: '2023 to 2024', value: 2024, attributes: { 'data-test': 'sroc-years-2024' } },
{ text: '2022 to 2023', value: 2023, attributes: { 'data-test': 'sroc-years-2023' } },
{
text: 'Before 2022',
value: 'preSroc',
hint: { text: 'Old charge scheme' },
attributes: { 'data-test': 'pre-sroc-years' }
}
])
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,14 @@ describe('Submit Mark For Supplementary Billing Service', () => {
licenceId: licence.id,
licenceRef: licence.licenceRef,
financialYears: [
{ text: '2023 to 2024', value: 2024 },
{ text: '2022 to 2023', value: 2023 },
{ text: 'Before 2022', value: 'preSroc', hint: { text: 'Old charge scheme' } }
{ text: '2023 to 2024', value: 2024, attributes: { 'data-test': 'sroc-years-2024' } },
{ text: '2022 to 2023', value: 2023, attributes: { 'data-test': 'sroc-years-2023' } },
{
text: 'Before 2022',
value: 'preSroc',
hint: { text: 'Old charge scheme' },
attributes: { 'data-test': 'pre-sroc-years' }
}
]
})
})
Expand Down

0 comments on commit ee3639c

Please sign in to comment.