Jasmine tests of validation utility

Includes a modification of validation logic which performs min and max length checks on optional fields in addition to required fields.