test registration response validation function

This commit is contained in:
Ben Wheeler 2019-10-23 05:19:42 -04:00
parent 469db4dc36
commit 7ec4af6c10

View file

@ -139,4 +139,11 @@ describe('unit test lib/validate.js', () => {
response = validate.validateEmailLocally('much."more unusual"@example.com'); response = validate.validateEmailLocally('much."more unusual"@example.com');
expect(response).toEqual({valid: false, errMsgId: 'registration.validationEmailInvalid'}); expect(response).toEqual({valid: false, errMsgId: 'registration.validationEmailInvalid'});
}); });
test('get responseErrorMsg', () => {
let response = validate.responseErrorMsg('username', 'bad username');
expect(response).toEqual('registration.errorBadUsername');
response = validate.responseErrorMsg('password', 'Ensure this value has at least 6 characters (it has 3).');
expect(response).toEqual('registration.errorPasswordTooShort');
});
}); });