From fa2d8af62929d7ae77bf640af97e8a19ae5eeff4 Mon Sep 17 00:00:00 2001 From: Scott Dormand <61588381+ScottDormand96@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:09:04 +0000 Subject: [PATCH] Change links for three rod licence (#2077) * Change links for three rod licence https://eaflood.atlassian.net/browse/IWTF-3785 Remove change link for changing length for three rod licences on summary page * hide change link for lenght for three rod licence * lint * remove changes from this branch * check only number of rods not type --- .../__snapshots__/route.spec.js.snap | 121 ++++++++++++++++++ .../licence-summary/__tests__/route.spec.js | 23 ++-- .../pages/summary/licence-summary/route.js | 13 +- 3 files changed, 140 insertions(+), 17 deletions(-) diff --git a/packages/gafl-webapp-service/src/pages/summary/licence-summary/__tests__/__snapshots__/route.spec.js.snap b/packages/gafl-webapp-service/src/pages/summary/licence-summary/__tests__/__snapshots__/route.spec.js.snap index 233578b8c1..6aa626139f 100644 --- a/packages/gafl-webapp-service/src/pages/summary/licence-summary/__tests__/__snapshots__/route.spec.js.snap +++ b/packages/gafl-webapp-service/src/pages/summary/licence-summary/__tests__/__snapshots__/route.spec.js.snap @@ -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 { diff --git a/packages/gafl-webapp-service/src/pages/summary/licence-summary/__tests__/route.spec.js b/packages/gafl-webapp-service/src/pages/summary/licence-summary/__tests__/route.spec.js index 3015c8565b..0637e3ad11 100644 --- a/packages/gafl-webapp-service/src/pages/summary/licence-summary/__tests__/route.spec.js +++ b/packages/gafl-webapp-service/src/pages/summary/licence-summary/__tests__/route.spec.js @@ -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 } }) @@ -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(), numberOfRods: '3' }} `('creates licence summary name rows for $desc', async ({ currentPermission }) => { const mockRequest = getMockRequest({ currentPermission }) const data = await getData(mockRequest) diff --git a/packages/gafl-webapp-service/src/pages/summary/licence-summary/route.js b/packages/gafl-webapp-service/src/pages/summary/licence-summary/route.js index b91b3b4ec2..b43e637f6b 100644 --- a/packages/gafl-webapp-service/src/pages/summary/licence-summary/route.js +++ b/packages/gafl-webapp-service/src/pages/summary/licence-summary/route.js @@ -113,12 +113,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.numberOfRods !== '3') { + args.push(LICENCE_LENGTH.uri, 'change-licence-length') + } + + return this.generateStandardRow(...args) } }