@defra-fish/gafl-webapp-service 1.64.0 → 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/locales/cy.json +8 -1
- package/src/locales/en.json +8 -1
- 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/routes/journey-definition.js +2 -1
- package/src/pages/recurring-payments/cancel/details/__tests__/route.test.js +0 -106
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defra-fish/gafl-webapp-service",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.65.0-rc.0",
|
|
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.
|
|
40
|
-
"@defra-fish/connectors-lib": "1.
|
|
39
|
+
"@defra-fish/business-rules-lib": "1.65.0-rc.0",
|
|
40
|
+
"@defra-fish/connectors-lib": "1.65.0-rc.0",
|
|
41
41
|
"@defra/hapi-gapi": "2.0.0",
|
|
42
42
|
"@hapi/boom": "9.1.2",
|
|
43
43
|
"@hapi/catbox-redis": "6.0.2",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"./gafl-jest-matchers.js"
|
|
80
80
|
]
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "cdf9253964871c4afe0ff85d085364ffe4e890cf"
|
|
83
83
|
}
|
package/src/locales/cy.json
CHANGED
|
@@ -182,6 +182,7 @@
|
|
|
182
182
|
"client_error_payment_start_again_pre": "Neu, os byddai’n well gennych, gallwch waredu’r drwydded hon a ",
|
|
183
183
|
"client_error_payment_start_again": "dechrau eto",
|
|
184
184
|
"concession_applied": "Consesiwn wedi’i gynnwys",
|
|
185
|
+
"confirm_continue": "Confirm and continue",
|
|
185
186
|
"contact_summary_change": "Newid",
|
|
186
187
|
"contact_summary_email": "e-bost i ",
|
|
187
188
|
"contact_summary_hidden_address": "cyfeiriad",
|
|
@@ -787,7 +788,13 @@
|
|
|
787
788
|
"role_required_title": "Role required",
|
|
788
789
|
"rp_cancel_complete_title": "Cancel your recurring card payment agreement - complete",
|
|
789
790
|
"rp_cancel_confirm_title": "Cancel your recurring card payment agreement - confirm",
|
|
790
|
-
"
|
|
791
|
+
"rp_cancel_details_last_purchased": "Last licence purchased",
|
|
792
|
+
"rp_cancel_details_licence_holder": "Licence holder",
|
|
793
|
+
"rp_cancel_details_licence_type": "Licence type",
|
|
794
|
+
"rp_cancel_details_licence_valid_until": "Licence valid until",
|
|
795
|
+
"rp_cancel_details_payment_card": "Payment card (last 4 digits)",
|
|
796
|
+
"rp_cancel_details_title": "Check your details",
|
|
797
|
+
"rp_cancel_details_summary_title": "If you need help checking your details",
|
|
791
798
|
"save_changes": "Cadw newidiadau",
|
|
792
799
|
"server_error_title_suffix": " - GOV.UK",
|
|
793
800
|
"server_error_bulletpoint_1": "Os ydych chi wedi gofyn am hysbysiad dros e-bost neu neges destun, dylai’r hysbysiad gyrraedd o fewn 3 awr os bydd y taliad wedi cael ei gymryd.",
|
package/src/locales/en.json
CHANGED
|
@@ -182,6 +182,7 @@
|
|
|
182
182
|
"client_error_payment_start_again_pre": "Or, if you wish, you can discard this licence and ",
|
|
183
183
|
"client_error_payment_start_again": "start again",
|
|
184
184
|
"concession_applied": "Concession applied",
|
|
185
|
+
"confirm_continue": "Confirm and continue",
|
|
185
186
|
"contact_summary_change": "Change",
|
|
186
187
|
"contact_summary_email": "Email to ",
|
|
187
188
|
"contact_summary_hidden_address": "address",
|
|
@@ -787,7 +788,13 @@
|
|
|
787
788
|
"role_required_title": "Role required",
|
|
788
789
|
"rp_cancel_complete_title": "Cancel your recurring card payment agreement - complete",
|
|
789
790
|
"rp_cancel_confirm_title": "Cancel your recurring card payment agreement - confirm",
|
|
790
|
-
"
|
|
791
|
+
"rp_cancel_details_last_purchased": "Last licence purchased",
|
|
792
|
+
"rp_cancel_details_licence_holder": "Licence holder",
|
|
793
|
+
"rp_cancel_details_licence_type": "Licence type",
|
|
794
|
+
"rp_cancel_details_licence_valid_until": "Licence valid until",
|
|
795
|
+
"rp_cancel_details_payment_card": "Payment card (last 4 digits)",
|
|
796
|
+
"rp_cancel_details_title": "Check your details",
|
|
797
|
+
"rp_cancel_details_summary_title": "If you need help checking your details",
|
|
791
798
|
"save_changes": "Save changes",
|
|
792
799
|
"server_error_title_suffix": " - GOV.UK",
|
|
793
800
|
"server_error_bulletpoint_1": "If you have requested an email or text notification, this should be delivered in 3 hours if a payment has been taken.",
|
|
@@ -0,0 +1,131 @@
|
|
|
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
|
+
import { getData } from '../route.js'
|
|
5
|
+
|
|
6
|
+
jest.mock('../../../../../routes/page-route.js')
|
|
7
|
+
jest.mock('../../../../../uri.js', () => ({
|
|
8
|
+
...jest.requireActual('../../../../../uri.js'),
|
|
9
|
+
CANCEL_RP_DETAILS: { page: Symbol('cancel-rp-details-page'), uri: Symbol('cancel-rp-details-uri') },
|
|
10
|
+
CANCEL_RP_CONFIRM: { uri: Symbol('cancel-rp-confirm-uri') }
|
|
11
|
+
}))
|
|
12
|
+
jest.mock('../../../../../processors/uri-helper.js')
|
|
13
|
+
|
|
14
|
+
describe('route', () => {
|
|
15
|
+
beforeEach(jest.clearAllMocks)
|
|
16
|
+
|
|
17
|
+
describe('pageRoute receives expected arguments', () => {
|
|
18
|
+
it('should call the pageRoute with cancel-rp-details, /buy/cancel-recurring-payment/details, dateOfBirthValidator, nextPage and getData', async () => {
|
|
19
|
+
jest.isolateModules(() => {
|
|
20
|
+
require('../route.js')
|
|
21
|
+
expect(pageRoute).toHaveBeenCalledWith(
|
|
22
|
+
CANCEL_RP_DETAILS.page,
|
|
23
|
+
CANCEL_RP_DETAILS.uri,
|
|
24
|
+
expect.any(Function),
|
|
25
|
+
expect.any(Function),
|
|
26
|
+
expect.any(Function)
|
|
27
|
+
)
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it('calls addLanguageCodeToUri with request object', async () => {
|
|
33
|
+
jest.isolateModules(() => {
|
|
34
|
+
require('../route.js')
|
|
35
|
+
})
|
|
36
|
+
const [[, , , completion]] = pageRoute.mock.calls
|
|
37
|
+
const sampleRequest = Symbol('sample request')
|
|
38
|
+
completion(sampleRequest)
|
|
39
|
+
expect(addLanguageCodeToUri).toHaveBeenCalledWith(sampleRequest, expect.anything())
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it('calls addLanguageCodeToUri with CANCEL_RP_AUTHENTICATE uri', () => {
|
|
43
|
+
jest.isolateModules(() => {
|
|
44
|
+
require('../route.js')
|
|
45
|
+
})
|
|
46
|
+
const [[, , , completion]] = pageRoute.mock.calls
|
|
47
|
+
completion({})
|
|
48
|
+
expect(addLanguageCodeToUri).toHaveBeenCalledWith(expect.anything(), CANCEL_RP_CONFIRM.uri)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('returns the value of addLanguageCodeToUri', () => {
|
|
52
|
+
jest.isolateModules(() => {
|
|
53
|
+
require('../route.js')
|
|
54
|
+
})
|
|
55
|
+
const [[, , , completion]] = pageRoute.mock.calls
|
|
56
|
+
const expectedCompletionRedirect = Symbol('expected-completion-redirect')
|
|
57
|
+
addLanguageCodeToUri.mockReturnValueOnce(expectedCompletionRedirect)
|
|
58
|
+
|
|
59
|
+
const completionRedirect = completion({})
|
|
60
|
+
|
|
61
|
+
expect(completionRedirect).toBe(expectedCompletionRedirect)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const getSampleCatalog = () => ({
|
|
65
|
+
rp_cancel_details_licence_holder: 'Licence holder',
|
|
66
|
+
rp_cancel_details_licence_type: 'Licence type',
|
|
67
|
+
rp_cancel_details_payment_card: 'Payment card',
|
|
68
|
+
rp_cancel_details_last_purchased: 'Last purchased',
|
|
69
|
+
rp_cancel_details_licence_valid_until: 'Valid until'
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
const getSamplePermission = () => ({
|
|
73
|
+
permission: {
|
|
74
|
+
licensee: {
|
|
75
|
+
firstName: 'John',
|
|
76
|
+
lastName: 'Smith'
|
|
77
|
+
},
|
|
78
|
+
permit: {
|
|
79
|
+
description: 'Salmon and sea trout'
|
|
80
|
+
},
|
|
81
|
+
endDate: '01-01-2026',
|
|
82
|
+
referenceNumber: 'abc123'
|
|
83
|
+
},
|
|
84
|
+
recurringPayment: {
|
|
85
|
+
lastDigitsCardNumbers: 1234
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
const createMockRequest = ({ currentPermission = getSamplePermission(), catalog = getSampleCatalog() } = {}) => ({
|
|
90
|
+
cache: () => ({
|
|
91
|
+
helpers: {
|
|
92
|
+
transaction: {
|
|
93
|
+
getCurrentPermission: jest.fn().mockResolvedValue(currentPermission)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}),
|
|
97
|
+
i18n: {
|
|
98
|
+
getCatalog: () => catalog
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
describe('getData', () => {
|
|
103
|
+
beforeEach(() => {
|
|
104
|
+
jest.clearAllMocks()
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
it('returns request.i18n.getCatalog()', async () => {
|
|
108
|
+
const mssgs = getSampleCatalog()
|
|
109
|
+
const mockRequest = createMockRequest({ catalog: mssgs })
|
|
110
|
+
|
|
111
|
+
const result = await getData(mockRequest)
|
|
112
|
+
|
|
113
|
+
expect(result.mssgs).toEqual(mssgs)
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
it('returns summaryTable with expected data', async () => {
|
|
117
|
+
const mssgs = getSampleCatalog()
|
|
118
|
+
const mockRequest = createMockRequest({ catalog: mssgs })
|
|
119
|
+
|
|
120
|
+
const result = await getData(mockRequest)
|
|
121
|
+
|
|
122
|
+
expect(result.summaryTable).toEqual([
|
|
123
|
+
{ key: { text: mssgs.rp_cancel_details_licence_holder }, value: { text: 'John Smith' } },
|
|
124
|
+
{ key: { text: mssgs.rp_cancel_details_licence_type }, value: { text: 'Salmon and sea trout' } },
|
|
125
|
+
{ key: { text: mssgs.rp_cancel_details_payment_card }, value: { text: 1234 } },
|
|
126
|
+
{ key: { text: mssgs.rp_cancel_details_last_purchased }, value: { text: 'abc123' } },
|
|
127
|
+
{ key: { text: mssgs.rp_cancel_details_licence_valid_until }, value: { text: '01-01-2026' } }
|
|
128
|
+
])
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
})
|
|
@@ -2,22 +2,70 @@
|
|
|
2
2
|
|
|
3
3
|
{% from "button/macro.njk" import govukButton %}
|
|
4
4
|
{% from "page-title.njk" import pageTitle %}
|
|
5
|
+
{% from "fieldset/macro.njk" import govukFieldset %}
|
|
6
|
+
{% from "summary-list/macro.njk" import govukSummaryList %}
|
|
7
|
+
{% from "details/macro.njk" import govukDetails %}
|
|
5
8
|
|
|
6
9
|
{% set title = mssgs.rp_cancel_details_title %}
|
|
7
10
|
{% block pageTitle %}{{ pageTitle(title, error, mssgs) }}{% endblock %}
|
|
8
11
|
|
|
12
|
+
{% set licenseDetailsSummary %}
|
|
13
|
+
{% set legendHtml %}
|
|
14
|
+
<span class="govuk-caption-l">{{ mssgs.cancel_rp_identify_caption }}</span>
|
|
15
|
+
{{ title }}
|
|
16
|
+
{% endset %}
|
|
17
|
+
|
|
18
|
+
{% call govukFieldset({
|
|
19
|
+
legend: {
|
|
20
|
+
html: legendHtml,
|
|
21
|
+
classes: "govuk-fieldset__legend--l govuk-!-margin-bottom-3",
|
|
22
|
+
isPageHeading: true
|
|
23
|
+
}
|
|
24
|
+
}) %}
|
|
25
|
+
{{ govukSummaryList({
|
|
26
|
+
classes: 'licence-summary-list',
|
|
27
|
+
rows: data.summaryTable
|
|
28
|
+
}) }}
|
|
29
|
+
{% endcall %}
|
|
30
|
+
{% endset -%}
|
|
31
|
+
|
|
32
|
+
{% set detailsHtml %}
|
|
33
|
+
<p class="govuk-body">
|
|
34
|
+
{{ mssgs.refund_bulletpoint_1_2 }}
|
|
35
|
+
</p>
|
|
36
|
+
<p class="govuk-body">
|
|
37
|
+
{{ mssgs.refund_bulletpoint_1_3 }}
|
|
38
|
+
</p>
|
|
39
|
+
<p class="govuk-body">
|
|
40
|
+
{{ mssgs.refund_bulletpoint_1_4 }}
|
|
41
|
+
</p>
|
|
42
|
+
<p class="govuk-body govuk-!-margin-bottom-0">
|
|
43
|
+
<a class="govuk-link" href="https://www.gov.uk/call-charges" target="_blank" rel="noreferrer noopener">
|
|
44
|
+
{{ mssgs.refund_bulletpoint_1_5 }}
|
|
45
|
+
</a>
|
|
46
|
+
</p>
|
|
47
|
+
{% endset %}
|
|
48
|
+
|
|
9
49
|
{% block content %}
|
|
10
50
|
<div class="govuk-grid-row">
|
|
11
51
|
<div class="govuk-grid-column-two-thirds">
|
|
12
|
-
<form method="post"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
52
|
+
<form method="post">
|
|
53
|
+
{{ licenseDetailsSummary | trim | safe }}
|
|
54
|
+
|
|
55
|
+
{{ govukButton({
|
|
56
|
+
attributes: { id: 'continue' },
|
|
57
|
+
preventDoubleClick: true,
|
|
58
|
+
name: "continue",
|
|
59
|
+
text: mssgs.confirm_continue,
|
|
60
|
+
classes: "govuk-!-margin-top-5"
|
|
61
|
+
}) }}
|
|
62
|
+
|
|
63
|
+
{{ govukDetails({
|
|
64
|
+
summaryText: mssgs.rp_cancel_details_summary_title,
|
|
65
|
+
html: detailsHtml
|
|
66
|
+
}) }}
|
|
67
|
+
|
|
68
|
+
{{ csrf() }}
|
|
21
69
|
</form>
|
|
22
70
|
</div>
|
|
23
71
|
</div>
|
|
@@ -2,10 +2,31 @@ import pageRoute from '../../../../routes/page-route.js'
|
|
|
2
2
|
import { CANCEL_RP_DETAILS, CANCEL_RP_CONFIRM } from '../../../../uri.js'
|
|
3
3
|
import { addLanguageCodeToUri } from '../../../../processors/uri-helper.js'
|
|
4
4
|
|
|
5
|
+
const getLicenseeDetailsSummaryRows = (currentPermission, mssgs) => [
|
|
6
|
+
{
|
|
7
|
+
key: { text: mssgs.rp_cancel_details_licence_holder },
|
|
8
|
+
value: { text: `${currentPermission.permission.licensee.firstName} ${currentPermission.permission.licensee.lastName}` }
|
|
9
|
+
},
|
|
10
|
+
{ key: { text: mssgs.rp_cancel_details_licence_type }, value: { text: currentPermission.permission.permit.description } },
|
|
11
|
+
{ key: { text: mssgs.rp_cancel_details_payment_card }, value: { text: currentPermission.recurringPayment.lastDigitsCardNumbers } },
|
|
12
|
+
{ key: { text: mssgs.rp_cancel_details_last_purchased }, value: { text: currentPermission.permission.referenceNumber } },
|
|
13
|
+
{ key: { text: mssgs.rp_cancel_details_licence_valid_until }, value: { text: currentPermission.permission.endDate } }
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
export const getData = async request => {
|
|
17
|
+
const currentPermission = await request.cache().helpers.transaction.getCurrentPermission()
|
|
18
|
+
const mssgs = request.i18n.getCatalog()
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
mssgs,
|
|
22
|
+
summaryTable: getLicenseeDetailsSummaryRows(currentPermission, mssgs)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
5
26
|
export default pageRoute(
|
|
6
27
|
CANCEL_RP_DETAILS.page,
|
|
7
28
|
CANCEL_RP_DETAILS.uri,
|
|
8
29
|
() => {},
|
|
9
30
|
request => addLanguageCodeToUri(request, CANCEL_RP_CONFIRM.uri),
|
|
10
|
-
|
|
31
|
+
getData
|
|
11
32
|
)
|
|
@@ -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
|
-
})
|