Skip to content

Instantly share code, notes, and snippets.

@pedrovgs
Created March 30, 2019 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedrovgs/d83fe1f096928715a6f31946e557995a to your computer and use it in GitHub Desktop.
Save pedrovgs/d83fe1f096928715a6f31946e557995a to your computer and use it in GitHub Desktop.
Form validation kata statement

Most of our tasks as software engineers are related to forms. Sign up forms, sing in forms, onboarding forms, etc. So today we are going to practice how to validate any form data using accumulative errors so we can now in just one method invocation what are the errors our form contains.

Our task for today's practice is to write a program to be able to validate if the data contained in a form with the following information is valid or not.

  • First name: It can't be empty.
  • Lst name: It can't be empty.
  • Birthdate. It has to be, at least, 18 years old.
  • Document ID: A value containing eight digits and one letter.
  • Phone number: Any combination of 9 numbers.
  • Email: Any valid email.

If the data is not valid, we will have to provide all the errors present in this form to the program user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment