Skip to content

Commit 8cb5478

Browse files
authored
chore(DF-832): bump @defra/forms-model to 3.0.648 (DF-832) (#791)
* chore(deps): bump @defra/forms-model to 3.0.648 (DF-832) Picks up DF-832 payment changes: - feat(model): add conditional amounts and email prepopulation to PaymentField (#1384) - fix(model): update paymentAmountSchema min to 0 (#1397) Enables saving PaymentField forms with options.amount: 0 (no payment by default) and accepts conditionalAmounts / emailField options. DF-832 * test(definition): update payment amount tests for min(0) schema (DF-832) paymentAmountSchema minimum changed from 0.3 to 0 in @defra/forms-model 3.0.648. Update assertions to match new semantics: - "greater than or equal to 0.3" error message → "0" - amount: 0 (no payment) now valid - amount: 0.1 now valid - Added 0 as the new minimum boundary test case DF-832
1 parent 4624e57 commit 8cb5478

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"dependencies": {
4444
"@aws-sdk/client-s3": "^3.995.0",
4545
"@aws-sdk/client-sns": "^3.995.0",
46-
"@defra/forms-model": "^3.0.645",
46+
"@defra/forms-model": "^3.0.648",
4747
"@defra/hapi-tracing": "^1.29.0",
4848
"@elastic/ecs-pino-format": "^1.5.0",
4949
"@hapi/hapi": "^21.4.4",

src/api/forms/service/helpers/definition.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ describe('definition helpers', () => {
160160
const definition = buildDefinition({ pages: [paymentPage] })
161161
const res = postSchemaValidation(definition)
162162
expect(res).toBeInstanceOf(Joi.ValidationError)
163-
expect(res?.message).toBe('"value" must be greater than or equal to 0.3')
163+
expect(res?.message).toBe('"value" must be greater than or equal to 0')
164164
})
165165

166166
it('should return error if payment enabled but ref num disabled', () => {
@@ -190,8 +190,6 @@ describe('definition helpers', () => {
190190
describe('validatePaymentAmount', () => {
191191
it.each([
192192
{ amount: -10, desc: 'negative' },
193-
{ amount: 0, desc: 'zero' },
194-
{ amount: 0.1, desc: 'below minimum (£0.30)' },
195193
{ amount: 100_001, desc: 'above maximum (£100,000)' },
196194
{ amount: NaN, desc: 'NaN' },
197195
{ amount: Infinity, desc: 'Infinity' }
@@ -203,7 +201,9 @@ describe('definition helpers', () => {
203201
)
204202

205203
it.each([
206-
{ amount: 0.3, desc: 'minimum boundary (£0.30)' },
204+
{ amount: 0, desc: 'zero / no payment (minimum boundary)' },
205+
{ amount: 0.1, desc: '£0.10' },
206+
{ amount: 0.3, desc: '£0.30' },
207207
{ amount: 1, desc: '£1' },
208208
{ amount: 100_000, desc: 'maximum boundary (£100,000)' }
209209
])(

0 commit comments

Comments
 (0)