@defra-fish/gafl-webapp-service 1.57.0-rc.4 → 1.57.0-rc.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra-fish/gafl-webapp-service",
3
- "version": "1.57.0-rc.4",
3
+ "version": "1.57.0-rc.6",
4
4
  "description": "The websales frontend for the GAFL service",
5
5
  "type": "module",
6
6
  "engines": {
@@ -36,8 +36,8 @@
36
36
  "prepare": "gulp --gulpfile build/gulpfile.cjs"
37
37
  },
38
38
  "dependencies": {
39
- "@defra-fish/business-rules-lib": "1.57.0-rc.4",
40
- "@defra-fish/connectors-lib": "1.57.0-rc.4",
39
+ "@defra-fish/business-rules-lib": "1.57.0-rc.6",
40
+ "@defra-fish/connectors-lib": "1.57.0-rc.6",
41
41
  "@defra/hapi-gapi": "^2.0.0",
42
42
  "@hapi/boom": "^9.1.2",
43
43
  "@hapi/catbox-redis": "^6.0.2",
@@ -80,5 +80,5 @@
80
80
  "./gafl-jest-matchers.js"
81
81
  ]
82
82
  },
83
- "gitHead": "54475774a2f320e8ba0ed1e6baa624e23f14decc"
83
+ "gitHead": "5c21e5443b8224f43c980c6a53746c593196500b"
84
84
  }
@@ -1128,18 +1128,6 @@ Array [
1128
1128
  },
1129
1129
  },
1130
1130
  Object {
1131
- "actions": Object {
1132
- "items": Array [
1133
- Object {
1134
- "attributes": Object {
1135
- "id": "change-licence-length",
1136
- },
1137
- "href": "/buy/licence-length",
1138
- "text": "contact_summary_change",
1139
- "visuallyHiddenText": "licence_summary_length",
1140
- },
1141
- ],
1142
- },
1143
1131
  "key": Object {
1144
1132
  "text": "licence_summary_length",
1145
1133
  },
@@ -7,7 +7,11 @@ import { licenceTypeDisplay } from '../../../../processors/licence-type-display.
7
7
  import { addLanguageCodeToUri } from '../../../../processors/uri-helper.js'
8
8
  import mappingConstants from '../../../../processors/mapping-constants.js'
9
9
  import { displayPermissionPrice } from '../../../../processors/price-display.js'
10
+ import { hasJunior } from '../../../../processors/concession-helper.js'
10
11
 
12
+ jest.mock('../../../../processors/concession-helper.js', () => ({
13
+ hasJunior: jest.fn(() => false)
14
+ }))
11
15
  jest.mock('../../../../processors/licence-type-display.js', () => ({
12
16
  licenceTypeDisplay: jest.fn(() => 'Special Canal Licence, Shopping Trollies and Old Wellies')
13
17
  }))
@@ -370,20 +374,30 @@ describe('licence-summary > route', () => {
370
374
  )
371
375
  })
372
376
 
377
+ it('calls hasJunior with permission', async () => {
378
+ const currentPermission = getMockNewPermission()
379
+ const mockRequest = getMockRequest({ currentPermission })
380
+
381
+ await getData(mockRequest)
382
+
383
+ expect(hasJunior).toHaveBeenCalledWith(currentPermission)
384
+ })
385
+
373
386
  describe('licence summary rows', () => {
374
387
  it.each`
375
- desc | currentPermission
376
- ${'1 year renewal'} | ${getMockPermission()}
377
- ${'1 year new licence'} | ${getMockNewPermission()}
378
- ${'1 year senior renewal'} | ${getMockSeniorPermission()}
379
- ${'8 day licence'} | ${{ ...getMockNewPermission(), licenceLength: '8D' }}
380
- ${'1 day licence'} | ${{ ...getMockNewPermission(), licenceLength: '1D' }}
381
- ${'Junior licence'} | ${getMockJuniorPermission()}
382
- ${'Blue badge concession'} | ${getMockBlueBadgePermission()}
383
- ${'Continuing permission'} | ${getMockContinuingPermission()}
384
- ${'Another date permission'} | ${{ ...getMockPermission(), licenceToStart: 'another-date' }}
385
- ${'1 year new three rod licence '} | ${{ ...getMockNewPermission(), numberOfRods: '3' }}
386
- `('creates licence summary name rows for $desc', async ({ currentPermission }) => {
388
+ desc | currentPermission | junior
389
+ ${'1 year renewal'} | ${getMockPermission()} | ${false}
390
+ ${'1 year new licence'} | ${getMockNewPermission()} | ${false}
391
+ ${'1 year senior renewal'} | ${getMockSeniorPermission()} | ${false}
392
+ ${'8 day licence'} | ${{ ...getMockNewPermission(), licenceLength: '8D' }} | ${false}
393
+ ${'1 day licence'} | ${{ ...getMockNewPermission(), licenceLength: '1D' }} | ${false}
394
+ ${'Junior licence'} | ${getMockJuniorPermission()} | ${true}
395
+ ${'Blue badge concession'} | ${getMockBlueBadgePermission()} | ${false}
396
+ ${'Continuing permission'} | ${getMockContinuingPermission()} | ${false}
397
+ ${'Another date permission'} | ${{ ...getMockPermission(), licenceToStart: 'another-date' }} | ${false}
398
+ ${'1 year new three rod licence '} | ${{ ...getMockNewPermission(), numberOfRods: '3' }} | ${false}
399
+ `('creates licence summary name rows for $desc', async ({ currentPermission, junior }) => {
400
+ hasJunior.mockReturnValueOnce(junior)
387
401
  const mockRequest = getMockRequest({ currentPermission })
388
402
  const data = await getData(mockRequest)
389
403
  expect(data.licenceSummaryRows).toMatchSnapshot()
@@ -22,6 +22,7 @@ import { CONCESSION, CONCESSION_PROOF } from '../../../processors/mapping-consta
22
22
  import { nextPage } from '../../../routes/next-page.js'
23
23
  import { addLanguageCodeToUri } from '../../../processors/uri-helper.js'
24
24
  import { displayPermissionPrice } from '../../../processors/price-display.js'
25
+ import { hasJunior } from '../../../processors/concession-helper.js'
25
26
  import db from 'debug'
26
27
  const debug = db('webapp:licence-summary')
27
28
 
@@ -115,7 +116,7 @@ class RowGenerator {
115
116
  generateLicenceLengthRow () {
116
117
  const args = ['licence_summary_length', this.labels[`licence_type_${this.permission.licenceLength.toLowerCase()}`]]
117
118
 
118
- if (this.permission.numberOfRods !== '3') {
119
+ if (this.permission.numberOfRods !== '3' && !hasJunior(this.permission)) {
119
120
  args.push(LICENCE_LENGTH.uri, 'change-licence-length')
120
121
  }
121
122