feat: add no leading zeros test to 3rd party services

This commit is contained in:
Sérgio Salgado 2022-02-16 03:02:02 +00:00
parent a7ee694169
commit 53975b02c2
11 changed files with 30 additions and 16 deletions

View file

@ -4,7 +4,7 @@ import CheckboxFormik from 'src/components/inputs/formik/Checkbox'
import NumberInputFormik from 'src/components/inputs/formik/NumberInput'
import SecretInputFormik from 'src/components/inputs/formik/SecretInput'
import secretTest from './helper'
import { secretTest, leadingZerosTest } from './helper'
export default {
code: 'ciphertrace',
@ -37,15 +37,19 @@ export default {
],
getValidationSchema: account => {
return Yup.object().shape({
authorizationValue: Yup.string('The score threshold must be a string')
.required('The authorization value is required')
authorizationValue: Yup.string('The authorization value must be a string')
.max(100, 'Too long')
.test(secretTest(account?.authorizationValue)),
scoreThreshold: Yup.number('The score threshold must be a number')
.required('A score threshold is required')
.min(1, 'The number should be between 1 and 10')
.max(10, 'The number should be between 1 and 10')
.test(secretTest(account?.scoreThreshold))
.min(1, 'The score threshold must be between 1 and 10')
.max(10, 'The score threshold must be between 1 and 10')
.integer('The score threshold must be an integer')
.test(
'no-leading-zeros',
'The score threshold must not have leading zeros',
leadingZerosTest
)
})
}
}