@defra-fish/gafl-webapp-service 1.64.0-rc.8 → 1.65.0-rc.0
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 +4 -4
- package/src/handlers/__tests__/cancel-recurring-payment-authentication-handler.spec.js +214 -0
- package/src/handlers/cancel-recurring-payment-authentication-handler.js +60 -0
- package/src/locales/cy.json +21 -2
- package/src/locales/en.json +21 -2
- package/src/pages/guidance/accessibility-statement.njk +5 -5
- package/src/pages/recurring-payments/cancel/details/__tests__/route.spec.js +131 -0
- package/src/pages/recurring-payments/cancel/details/cancel-rp-details.njk +57 -9
- package/src/pages/recurring-payments/cancel/details/route.js +22 -1
- package/src/pages/recurring-payments/cancel/identify/__tests__/route.spec.js +174 -0
- package/src/pages/recurring-payments/cancel/identify/cancel-rp-identify.njk +171 -4
- package/src/pages/recurring-payments/cancel/identify/route.js +51 -6
- package/src/processors/__tests__/recurring-payments-write-cache.spec.js +121 -0
- package/src/processors/recurring-payments-write-cache.js +16 -0
- package/src/routes/journey-definition.js +2 -1
- package/src/routes/misc-routes.js +1 -1
- package/src/handlers/__tests__/cancel-rp-authentication-handler.spec.js +0 -18
- package/src/handlers/cancel-rp-authentication-handler.js +0 -6
- package/src/pages/recurring-payments/cancel/details/__tests__/route.test.js +0 -106
- package/src/pages/recurring-payments/cancel/identify/__tests__/route.test.js +0 -106
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import pageRoute from '../../../../../routes/page-route.js'
|
|
2
|
-
import { CANCEL_RP_DETAILS, CANCEL_RP_CONFIRM } from '../../../../../uri.js'
|
|
3
|
-
import { addLanguageCodeToUri } from '../../../../../processors/uri-helper.js'
|
|
4
|
-
|
|
5
|
-
require('../route.js')
|
|
6
|
-
// eslint-disable-next-line no-unused-vars
|
|
7
|
-
const [[_v, _p, validator, completion, getData]] = pageRoute.mock.calls
|
|
8
|
-
|
|
9
|
-
jest.mock('../../../../../routes/page-route.js')
|
|
10
|
-
jest.mock('../../../../../uri.js', () => ({
|
|
11
|
-
...jest.requireActual('../../../../../uri.js'),
|
|
12
|
-
CANCEL_RP_DETAILS: { page: Symbol('cancel-rp-details-page'), uri: Symbol('cancel-rp-details-uri') },
|
|
13
|
-
CANCEL_RP_CONFIRM: { uri: Symbol('cancel-rp-confirm-uri') }
|
|
14
|
-
}))
|
|
15
|
-
jest.mock('../../../../../processors/uri-helper.js')
|
|
16
|
-
|
|
17
|
-
describe('pageRoute receives expected arguments', () => {
|
|
18
|
-
it('passes CANCEL_RP_DETAILS.page as the view name', () => {
|
|
19
|
-
jest.isolateModules(() => {
|
|
20
|
-
require('../route.js')
|
|
21
|
-
expect(pageRoute).toHaveBeenCalledWith(
|
|
22
|
-
CANCEL_RP_DETAILS.page,
|
|
23
|
-
expect.anything(),
|
|
24
|
-
expect.anything(),
|
|
25
|
-
expect.anything(),
|
|
26
|
-
expect.anything()
|
|
27
|
-
)
|
|
28
|
-
})
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it('passes CANCEL_RP_DETAILS.uri as the path', () => {
|
|
32
|
-
jest.isolateModules(() => {
|
|
33
|
-
require('../route.js')
|
|
34
|
-
expect(pageRoute).toHaveBeenCalledWith(
|
|
35
|
-
expect.anything(),
|
|
36
|
-
CANCEL_RP_DETAILS.uri,
|
|
37
|
-
expect.anything(),
|
|
38
|
-
expect.anything(),
|
|
39
|
-
expect.anything()
|
|
40
|
-
)
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
it('passes a function as the validator', () => {
|
|
45
|
-
jest.isolateModules(() => {
|
|
46
|
-
require('../route.js')
|
|
47
|
-
expect(pageRoute).toHaveBeenCalledWith(
|
|
48
|
-
expect.anything(),
|
|
49
|
-
expect.anything(),
|
|
50
|
-
expect.any(Function),
|
|
51
|
-
expect.anything(),
|
|
52
|
-
expect.anything()
|
|
53
|
-
)
|
|
54
|
-
})
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
it('passes a function to generate redirect location on completion', () => {
|
|
58
|
-
jest.isolateModules(() => {
|
|
59
|
-
require('../route.js')
|
|
60
|
-
expect(pageRoute).toHaveBeenCalledWith(
|
|
61
|
-
expect.anything(),
|
|
62
|
-
expect.anything(),
|
|
63
|
-
expect.anything(),
|
|
64
|
-
expect.any(Function),
|
|
65
|
-
expect.anything()
|
|
66
|
-
)
|
|
67
|
-
})
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
it('passes a function to get the page data', () => {
|
|
71
|
-
jest.isolateModules(() => {
|
|
72
|
-
require('../route.js')
|
|
73
|
-
expect(pageRoute).toHaveBeenCalledWith(
|
|
74
|
-
expect.anything(),
|
|
75
|
-
expect.anything(),
|
|
76
|
-
expect.anything(),
|
|
77
|
-
expect.anything(),
|
|
78
|
-
expect.any(Function)
|
|
79
|
-
)
|
|
80
|
-
})
|
|
81
|
-
})
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
describe('completion function', () => {
|
|
85
|
-
beforeEach(jest.clearAllMocks)
|
|
86
|
-
|
|
87
|
-
it('calls addLanguageCodeToUri with request object', () => {
|
|
88
|
-
const sampleRequest = Symbol('sample request')
|
|
89
|
-
completion(sampleRequest)
|
|
90
|
-
expect(addLanguageCodeToUri).toHaveBeenCalledWith(sampleRequest, expect.anything())
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
it('calls addLanguageCodeToUri with CANCEL_RP_AUTHENTICATE uri', () => {
|
|
94
|
-
completion({})
|
|
95
|
-
expect(addLanguageCodeToUri).toHaveBeenCalledWith(expect.anything(), CANCEL_RP_CONFIRM.uri)
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
it('returns the value of addLanguageCodeToUri', () => {
|
|
99
|
-
const expectedCompletionRedirect = Symbol('expected-completion-redirect')
|
|
100
|
-
addLanguageCodeToUri.mockReturnValueOnce(expectedCompletionRedirect)
|
|
101
|
-
|
|
102
|
-
const completionRedirect = completion({})
|
|
103
|
-
|
|
104
|
-
expect(completionRedirect).toBe(expectedCompletionRedirect)
|
|
105
|
-
})
|
|
106
|
-
})
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import pageRoute from '../../../../../routes/page-route.js'
|
|
2
|
-
import { CANCEL_RP_AUTHENTICATE, CANCEL_RP_IDENTIFY } from '../../../../../uri.js'
|
|
3
|
-
import { addLanguageCodeToUri } from '../../../../../processors/uri-helper.js'
|
|
4
|
-
|
|
5
|
-
require('../route.js')
|
|
6
|
-
// eslint-disable-next-line no-unused-vars
|
|
7
|
-
const [[_v, _p, validator, completion, getData]] = pageRoute.mock.calls
|
|
8
|
-
|
|
9
|
-
jest.mock('../../../../../routes/page-route.js')
|
|
10
|
-
jest.mock('../../../../../uri.js', () => ({
|
|
11
|
-
...jest.requireActual('../../../../../uri.js'),
|
|
12
|
-
CANCEL_RP_IDENTIFY: { page: Symbol('cancel-rp-identify'), uri: Symbol('cancel-rp-identify-uri') },
|
|
13
|
-
CANCEL_RP_AUTHENTICATE: { uri: Symbol('cancel-rp-authenticate-uri') }
|
|
14
|
-
}))
|
|
15
|
-
jest.mock('../../../../../processors/uri-helper.js')
|
|
16
|
-
|
|
17
|
-
describe('pageRoute receives expected arguments', () => {
|
|
18
|
-
it('passes CANCEL_RP_IDENTIFY.page as the view name', () => {
|
|
19
|
-
jest.isolateModules(() => {
|
|
20
|
-
require('../route.js')
|
|
21
|
-
expect(pageRoute).toHaveBeenCalledWith(
|
|
22
|
-
CANCEL_RP_IDENTIFY.page,
|
|
23
|
-
expect.anything(),
|
|
24
|
-
expect.anything(),
|
|
25
|
-
expect.anything(),
|
|
26
|
-
expect.anything()
|
|
27
|
-
)
|
|
28
|
-
})
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it('passes CANCEL_RP_IDENTIFY.uri as the path', () => {
|
|
32
|
-
jest.isolateModules(() => {
|
|
33
|
-
require('../route.js')
|
|
34
|
-
expect(pageRoute).toHaveBeenCalledWith(
|
|
35
|
-
expect.anything(),
|
|
36
|
-
CANCEL_RP_IDENTIFY.uri,
|
|
37
|
-
expect.anything(),
|
|
38
|
-
expect.anything(),
|
|
39
|
-
expect.anything()
|
|
40
|
-
)
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
it('passes a function as the validator', () => {
|
|
45
|
-
jest.isolateModules(() => {
|
|
46
|
-
require('../route.js')
|
|
47
|
-
expect(pageRoute).toHaveBeenCalledWith(
|
|
48
|
-
expect.anything(),
|
|
49
|
-
expect.anything(),
|
|
50
|
-
expect.any(Function),
|
|
51
|
-
expect.anything(),
|
|
52
|
-
expect.anything()
|
|
53
|
-
)
|
|
54
|
-
})
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
it('passes a function to generate redirect location on completion', () => {
|
|
58
|
-
jest.isolateModules(() => {
|
|
59
|
-
require('../route.js')
|
|
60
|
-
expect(pageRoute).toHaveBeenCalledWith(
|
|
61
|
-
expect.anything(),
|
|
62
|
-
expect.anything(),
|
|
63
|
-
expect.anything(),
|
|
64
|
-
expect.any(Function),
|
|
65
|
-
expect.anything()
|
|
66
|
-
)
|
|
67
|
-
})
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
it('passes a function to get the page data', () => {
|
|
71
|
-
jest.isolateModules(() => {
|
|
72
|
-
require('../route.js')
|
|
73
|
-
expect(pageRoute).toHaveBeenCalledWith(
|
|
74
|
-
expect.anything(),
|
|
75
|
-
expect.anything(),
|
|
76
|
-
expect.anything(),
|
|
77
|
-
expect.anything(),
|
|
78
|
-
expect.any(Function)
|
|
79
|
-
)
|
|
80
|
-
})
|
|
81
|
-
})
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
describe('completion function', () => {
|
|
85
|
-
beforeEach(jest.clearAllMocks)
|
|
86
|
-
|
|
87
|
-
it('calls addLanguageCodeToUri with request', () => {
|
|
88
|
-
const sampleRequest = Symbol('sample request')
|
|
89
|
-
completion(sampleRequest)
|
|
90
|
-
expect(addLanguageCodeToUri).toHaveBeenCalledWith(sampleRequest, expect.anything())
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
it('calls addLanguageCodeToUri with CANCEL_RP_AUTHENTICATE uri', () => {
|
|
94
|
-
completion({})
|
|
95
|
-
expect(addLanguageCodeToUri).toHaveBeenCalledWith(expect.anything(), CANCEL_RP_AUTHENTICATE.uri)
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
it('returns the value of addLanguageCodeToUri', () => {
|
|
99
|
-
const expectedCompletionRedirect = Symbol('expected-completion-redirect')
|
|
100
|
-
addLanguageCodeToUri.mockReturnValueOnce(expectedCompletionRedirect)
|
|
101
|
-
|
|
102
|
-
const completionRedirect = completion({})
|
|
103
|
-
|
|
104
|
-
expect(completionRedirect).toBe(expectedCompletionRedirect)
|
|
105
|
-
})
|
|
106
|
-
})
|