From 04c39fca1559d90a538a625827fa451162a5da25 Mon Sep 17 00:00:00 2001 From: Scott Dormand Date: Wed, 13 Nov 2024 10:20:59 +0000 Subject: [PATCH 1/5] 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 From 5a257193523cc56b4b29e56306a557a0c69513aa Mon Sep 17 00:00:00 2001 From: Scott Dormand Date: Wed, 13 Nov 2024 14:06:09 +0000 Subject: [PATCH 2/5] hide change link for lenght for three rod licence --- .../gafl-webapp-service/src/locales/cy.json | 6 +- .../gafl-webapp-service/src/locales/en.json | 6 +- .../__snapshots__/route.spec.js.snap | 121 ++++++++++++++++++ .../licence-summary/__tests__/route.spec.js | 23 ++-- .../pages/summary/licence-summary/route.js | 17 ++- 5 files changed, 150 insertions(+), 23 deletions(-) diff --git a/packages/gafl-webapp-service/src/locales/cy.json b/packages/gafl-webapp-service/src/locales/cy.json index b20be27875..fa2942b23b 100644 --- a/packages/gafl-webapp-service/src/locales/cy.json +++ b/packages/gafl-webapp-service/src/locales/cy.json @@ -466,11 +466,11 @@ "licence_type_payment_edge_case": "Mae’n rhaid i chi gwblhau eich taliad cyn 11:30pm ar 31 Mawrth 2024 i dalu’r pris a ddangosir", "licence_type_radio_salmon_hint": "Mae'n cynnwys brithyllod a physgod bras (hyd at 3 gwialen)", "licence_type_radio_salmon": "Eogiaid a brithyllod y môr", - "licence_type_radio_salmon_payment_summary": "eogiaid a brithyllod y môr", + "licence_type_radio_salmon_payment_summary": "Eogiaid a brithyllod y môr", "licence_type_radio_trout_three_rod": "Brithyllod a physgod bras (hyd at 3 gwialen)", - "licence_type_radio_trout_three_rod_payment_summary": "brithyllod a physgod bras (hyd at 3 gwialen)", + "licence_type_radio_trout_three_rod_payment_summary": "Brithyllod a physgod bras (hyd at 3 gwialen)", "licence_type_radio_trout_two_rod": "Brithyllod a physgod bras (hyd at 2 wialen)", - "licence_type_radio_trout_two_rod_payment_summary": "brithyllod a physgod bras (hyd at 2 wialen)", + "licence_type_radio_trout_two_rod_payment_summary": "Brithyllod a physgod bras (hyd at 2 wialen)", "licence_type_rules": "rheolau pysgota â gwialen (yn agor ar dudalen newydd)", "licence_type_salmon_acr_note_1": "Yn ôl y gyfraith, mae'n rhaid i chi roi gwybod am ", "licence_type_salmon_acr_note_2": " ffurflen daliadau (yn agor ar dudalen newydd)", diff --git a/packages/gafl-webapp-service/src/locales/en.json b/packages/gafl-webapp-service/src/locales/en.json index f73a836afa..d5fc5b9f92 100644 --- a/packages/gafl-webapp-service/src/locales/en.json +++ b/packages/gafl-webapp-service/src/locales/en.json @@ -466,11 +466,11 @@ "licence_type_payment_edge_case": "You must complete payment before 11:30pm on 31 March 2024 to get the price shown", "licence_type_radio_salmon_hint": "Includes trout and coarse (up to 3 rods)", "licence_type_radio_salmon": "Salmon and sea trout", - "licence_type_radio_salmon_payment_summary": "salmon and sea trout", + "licence_type_radio_salmon_payment_summary": "Salmon and sea trout", "licence_type_radio_trout_three_rod": "Trout and coarse (up to 3 rods)", - "licence_type_radio_trout_three_rod_payment_summary": "trout and coarse (up to 3 rods)", + "licence_type_radio_trout_three_rod_payment_summary": "Trout and coarse (up to 3 rods)", "licence_type_radio_trout_two_rod": "Trout and coarse (up to 2 rods)", - "licence_type_radio_trout_two_rod_payment_summary": "trout and coarse (up to 2 rods)", + "licence_type_radio_trout_two_rod_payment_summary": "Trout and coarse (up to 2 rods)", "licence_type_rules": "rod fishing rules (opens in new tab)", "licence_type_salmon_acr_note_1": "Licence holders must by law ", "licence_type_salmon_acr_note_2": " report a catch return (opens in new tab)", 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..1e893b3430 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(), licenceType: 'Trout and coarse', 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..370c8308c0 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 @@ -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') @@ -112,13 +113,17 @@ class RowGenerator { ) } - generateLicenceLengthRow () { - return this.generateStandardRow( + generateLicenceLengthRow() { + const args = [ 'licence_summary_length', - this.labels[`licence_type_${this.permission.licenceLength.toLowerCase()}`], - LICENCE_LENGTH.uri, - 'change-licence-length' - ) + this.labels[`licence_type_${this.permission.licenceLength.toLowerCase()}`] + ] + + if (!(this.permission.licenceType === mappings.LICENCE_TYPE['trout-and-coarse'] && this.permission.numberOfRods === '3')) { + args.push(LICENCE_LENGTH.uri, 'change-licence-length') + } + + return this.generateStandardRow(...args) } } From c5e1db333c79aabcfe56887574e81e62cadfc2d2 Mon Sep 17 00:00:00 2001 From: Scott Dormand Date: Wed, 13 Nov 2024 14:09:03 +0000 Subject: [PATCH 3/5] lint --- .../src/pages/summary/licence-summary/route.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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 370c8308c0..58e448a397 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,16 +113,13 @@ class RowGenerator { ) } - generateLicenceLengthRow() { - const args = [ - 'licence_summary_length', - this.labels[`licence_type_${this.permission.licenceLength.toLowerCase()}`] - ] - + generateLicenceLengthRow () { + 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')) { args.push(LICENCE_LENGTH.uri, 'change-licence-length') } - + return this.generateStandardRow(...args) } } From 88f935fbbc24c7086daa0aaa33c053bf266ca1ec Mon Sep 17 00:00:00 2001 From: Scott Dormand Date: Mon, 18 Nov 2024 07:24:40 +0000 Subject: [PATCH 4/5] remove changes from this branch --- packages/gafl-webapp-service/src/locales/cy.json | 6 +++--- packages/gafl-webapp-service/src/locales/en.json | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/gafl-webapp-service/src/locales/cy.json b/packages/gafl-webapp-service/src/locales/cy.json index fa2942b23b..b20be27875 100644 --- a/packages/gafl-webapp-service/src/locales/cy.json +++ b/packages/gafl-webapp-service/src/locales/cy.json @@ -466,11 +466,11 @@ "licence_type_payment_edge_case": "Mae’n rhaid i chi gwblhau eich taliad cyn 11:30pm ar 31 Mawrth 2024 i dalu’r pris a ddangosir", "licence_type_radio_salmon_hint": "Mae'n cynnwys brithyllod a physgod bras (hyd at 3 gwialen)", "licence_type_radio_salmon": "Eogiaid a brithyllod y môr", - "licence_type_radio_salmon_payment_summary": "Eogiaid a brithyllod y môr", + "licence_type_radio_salmon_payment_summary": "eogiaid a brithyllod y môr", "licence_type_radio_trout_three_rod": "Brithyllod a physgod bras (hyd at 3 gwialen)", - "licence_type_radio_trout_three_rod_payment_summary": "Brithyllod a physgod bras (hyd at 3 gwialen)", + "licence_type_radio_trout_three_rod_payment_summary": "brithyllod a physgod bras (hyd at 3 gwialen)", "licence_type_radio_trout_two_rod": "Brithyllod a physgod bras (hyd at 2 wialen)", - "licence_type_radio_trout_two_rod_payment_summary": "Brithyllod a physgod bras (hyd at 2 wialen)", + "licence_type_radio_trout_two_rod_payment_summary": "brithyllod a physgod bras (hyd at 2 wialen)", "licence_type_rules": "rheolau pysgota â gwialen (yn agor ar dudalen newydd)", "licence_type_salmon_acr_note_1": "Yn ôl y gyfraith, mae'n rhaid i chi roi gwybod am ", "licence_type_salmon_acr_note_2": " ffurflen daliadau (yn agor ar dudalen newydd)", diff --git a/packages/gafl-webapp-service/src/locales/en.json b/packages/gafl-webapp-service/src/locales/en.json index d5fc5b9f92..f73a836afa 100644 --- a/packages/gafl-webapp-service/src/locales/en.json +++ b/packages/gafl-webapp-service/src/locales/en.json @@ -466,11 +466,11 @@ "licence_type_payment_edge_case": "You must complete payment before 11:30pm on 31 March 2024 to get the price shown", "licence_type_radio_salmon_hint": "Includes trout and coarse (up to 3 rods)", "licence_type_radio_salmon": "Salmon and sea trout", - "licence_type_radio_salmon_payment_summary": "Salmon and sea trout", + "licence_type_radio_salmon_payment_summary": "salmon and sea trout", "licence_type_radio_trout_three_rod": "Trout and coarse (up to 3 rods)", - "licence_type_radio_trout_three_rod_payment_summary": "Trout and coarse (up to 3 rods)", + "licence_type_radio_trout_three_rod_payment_summary": "trout and coarse (up to 3 rods)", "licence_type_radio_trout_two_rod": "Trout and coarse (up to 2 rods)", - "licence_type_radio_trout_two_rod_payment_summary": "Trout and coarse (up to 2 rods)", + "licence_type_radio_trout_two_rod_payment_summary": "trout and coarse (up to 2 rods)", "licence_type_rules": "rod fishing rules (opens in new tab)", "licence_type_salmon_acr_note_1": "Licence holders must by law ", "licence_type_salmon_acr_note_2": " report a catch return (opens in new tab)", From 377017956bc83a1b84ba5c9f312695afc35fc3b6 Mon Sep 17 00:00:00 2001 From: Scott Dormand Date: Tue, 19 Nov 2024 07:30:03 +0000 Subject: [PATCH 5/5] check only number of rods not type --- .../src/pages/summary/licence-summary/__tests__/route.spec.js | 2 +- .../src/pages/summary/licence-summary/route.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) 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 1e893b3430..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 @@ -382,7 +382,7 @@ describe('licence-summary > route', () => { ${'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' }} + ${'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 58e448a397..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 @@ -22,7 +22,6 @@ 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') @@ -116,7 +115,7 @@ class RowGenerator { generateLicenceLengthRow () { 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')) { + if (this.permission.numberOfRods !== '3') { args.push(LICENCE_LENGTH.uri, 'change-licence-length') }