From 6ab979cca34359e4489f214cf380fe26203dd7dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20S=C3=A1?= Date: Mon, 6 Dec 2021 20:04:02 +0000 Subject: [PATCH] refactor: use `min()` instead of `test()` --- new-lamassu-admin/src/pages/Authentication/Register.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/new-lamassu-admin/src/pages/Authentication/Register.js b/new-lamassu-admin/src/pages/Authentication/Register.js index 730294ca..a2d54c92 100644 --- a/new-lamassu-admin/src/pages/Authentication/Register.js +++ b/new-lamassu-admin/src/pages/Authentication/Register.js @@ -42,13 +42,13 @@ const REGISTER = gql` } ` +const PASSWORD_MIN_LENGTH = 8 const validationSchema = Yup.object({ password: Yup.string() .required('A password is required') - .test( - 'len', - 'Your password must contain at least 8 characters', - val => val.length >= 8 + .min( + PASSWORD_MIN_LENGTH, + `Your password must contain at least ${PASSWORD_MIN_LENGTH} characters` ), confirmPassword: Yup.string() .required('Please confirm the password')