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

Change links for three rod licence #2077

Merged
merged 5 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,127 @@ Array [
]
`;

exports[`licence-summary > route licence summary rows creates licence summary name rows for 1 year new three rod licence 1`] = `
Array [
Object {
"actions": Object {
"items": Array [
Object {
"attributes": Object {
"id": "change-name",
},
"href": "/buy/name",
"text": "contact_summary_change",
"visuallyHiddenText": "licence_summary_name",
},
],
},
"key": Object {
"text": "licence_summary_name",
},
"value": Object {
"html": "Brenin Pysgotwr",
},
},
Object {
"actions": Object {
"items": Array [
Object {
"attributes": Object {
"id": "change-birth-date",
},
"href": "/buy/date-of-birth",
"text": "contact_summary_change",
"visuallyHiddenText": "licence_summary_dob",
},
],
},
"key": Object {
"text": "licence_summary_dob",
},
"value": Object {
"html": "1st January 1946",
},
},
Object {
"actions": Object {
"items": Array [
Object {
"attributes": Object {
"id": "change-licence-type",
},
"href": "/buy/licence-type",
"text": "contact_summary_change",
"visuallyHiddenText": "licence_summary_type",
},
],
},
"key": Object {
"text": "licence_summary_type",
},
"value": Object {
"html": "Special Canal Licence, Shopping Trollies and Old Wellies",
},
},
Object {
"key": Object {
"text": "licence_summary_length",
},
"value": Object {
"html": "licence_type_12m",
},
},
Object {
"actions": Object {
"items": Array [
Object {
"attributes": Object {
"id": "change-licence-to-start",
},
"href": "/buy/start-kind",
"text": "contact_summary_change",
"visuallyHiddenText": "licence_summary_start_date",
},
],
},
"key": Object {
"text": "licence_summary_start_date",
},
"value": Object {
"html": "30licence_summary_minutes_after_payment",
},
},
Object {
"actions": Object {
"items": Array [
Object {
"attributes": Object {
"id": "change-benefit-check",
},
"href": "/buy/disability-concession",
"text": "contact_summary_change",
"visuallyHiddenText": "licence_summary_ni_num",
},
],
},
"key": Object {
"text": "licence_summary_ni_num",
},
"value": Object {
"html": "AB 12 34 56 A",
},
},
Object {
"key": Object {
"text": "damage",
},
"value": Object {
"html": "#6",
},
},
]
`;

exports[`licence-summary > route licence summary rows creates licence summary name rows for 1 year renewal 1`] = `
Array [
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const getMockPermission = (licenseeOverrides = {}) => ({
licenceToStart: 'after-payment',
licenceStartDate: '2022-11-10',
licenceType: 'Trout and coarse',
numberOfRods: '3',
numberOfRods: '2',
permit: { cost: 6 }
})

Expand Down Expand Up @@ -372,16 +372,17 @@ describe('licence-summary > route', () => {

describe('licence summary rows', () => {
it.each`
desc | currentPermission
${'1 year renewal'} | ${getMockPermission()}
${'1 year new licence'} | ${getMockNewPermission()}
${'1 year senior renewal'} | ${getMockSeniorPermission()}
${'8 day licence'} | ${{ ...getMockNewPermission(), licenceLength: '8D' }}
${'1 day licence'} | ${{ ...getMockNewPermission(), licenceLength: '1D' }}
${'Junior licence'} | ${getMockJuniorPermission()}
${'Blue badge concession'} | ${getMockBlueBadgePermission()}
${'Continuing permission'} | ${getMockContinuingPermission()}
${'Another date permission'} | ${{ ...getMockPermission(), licenceToStart: 'another-date' }}
desc | currentPermission
${'1 year renewal'} | ${getMockPermission()}
${'1 year new licence'} | ${getMockNewPermission()}
${'1 year senior renewal'} | ${getMockSeniorPermission()}
${'8 day licence'} | ${{ ...getMockNewPermission(), licenceLength: '8D' }}
${'1 day licence'} | ${{ ...getMockNewPermission(), licenceLength: '1D' }}
${'Junior licence'} | ${getMockJuniorPermission()}
${'Blue badge concession'} | ${getMockBlueBadgePermission()}
${'Continuing permission'} | ${getMockContinuingPermission()}
${'Another date permission'} | ${{ ...getMockPermission(), licenceToStart: 'another-date' }}
${'1 year new three rod licence '} | ${{ ...getMockNewPermission(), licenceType: 'Trout and coarse', numberOfRods: '3' }}
`('creates licence summary name rows for $desc', async ({ currentPermission }) => {
const mockRequest = getMockRequest({ currentPermission })
const data = await getData(mockRequest)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { CONCESSION, CONCESSION_PROOF } from '../../../processors/mapping-consta
import { nextPage } from '../../../routes/next-page.js'
import { addLanguageCodeToUri } from '../../../processors/uri-helper.js'
import { displayPermissionPrice } from '../../../processors/price-display.js'
import * as mappings from '../../../processors/mapping-constants.js'
import db from 'debug'
const debug = db('webapp:licence-summary')

Expand Down Expand Up @@ -113,12 +114,13 @@ class RowGenerator {
}

generateLicenceLengthRow () {
return this.generateStandardRow(
'licence_summary_length',
this.labels[`licence_type_${this.permission.licenceLength.toLowerCase()}`],
LICENCE_LENGTH.uri,
'change-licence-length'
)
const args = ['licence_summary_length', this.labels[`licence_type_${this.permission.licenceLength.toLowerCase()}`]]

if (!(this.permission.licenceType === mappings.LICENCE_TYPE['trout-and-coarse'] && this.permission.numberOfRods === '3')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that there's no 3-rod salmon licence, could we just check the number of rods and ignore the licence type? Slightly simpler.

args.push(LICENCE_LENGTH.uri, 'change-licence-length')
}

return this.generateStandardRow(...args)
}
}

Expand Down
Loading