mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-29 18:46:20 -05:00
added test for error string with no message
This commit is contained in:
parent
b1d71f2a4d
commit
0305fff670
1 changed files with 6 additions and 1 deletions
|
@ -140,10 +140,15 @@ describe('unit test lib/validate.js', () => {
|
||||||
expect(response).toEqual({valid: false, errMsgId: 'registration.validationEmailInvalid'});
|
expect(response).toEqual({valid: false, errMsgId: 'registration.validationEmailInvalid'});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('get responseErrorMsg', () => {
|
test('get responseErrorMsg in cases where there is a dedicated string for that case', () => {
|
||||||
let response = validate.responseErrorMsg('username', 'bad username');
|
let response = validate.responseErrorMsg('username', 'bad username');
|
||||||
expect(response).toEqual('registration.errorBadUsername');
|
expect(response).toEqual('registration.errorBadUsername');
|
||||||
response = validate.responseErrorMsg('password', 'Ensure this value has at least 6 characters (it has 3).');
|
response = validate.responseErrorMsg('password', 'Ensure this value has at least 6 characters (it has 3).');
|
||||||
expect(response).toEqual('registration.errorPasswordTooShort');
|
expect(response).toEqual('registration.errorPasswordTooShort');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('responseErrorMsg is null in case where there is no dedicated string for that case', () => {
|
||||||
|
let response = validate.responseErrorMsg('username', 'some error that is not covered');
|
||||||
|
expect(response).toEqual(null);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue