CST-6110 changes for robust password error

This commit is contained in:
nikunj59
2022-06-21 21:42:33 +05:30
parent 26ed23d1b6
commit 0a73875d17
9 changed files with 53 additions and 4 deletions

View File

@@ -238,6 +238,24 @@ describe('CreateProfileComponent', () => {
expect(router.navigate).not.toHaveBeenCalled();
expect(notificationsService.error).toHaveBeenCalled();
});
it('should submit an eperson for creation but password is weak', () => {
(ePersonDataService.createEPersonForToken as jasmine.Spy).and.returnValue(createFailedRemoteDataObject$('Error', 422));
comp.firstName.patchValue('First');
comp.lastName.patchValue('Last');
comp.contactPhone.patchValue('Phone');
comp.language.patchValue('en');
comp.password = 'password';
comp.isInValidPassword = false;
comp.submitEperson();
expect(ePersonDataService.createEPersonForToken).toHaveBeenCalledWith(eperson, 'test-token');
expect(comp.isRobustPasswordError.value).toBeTrue();
});
it('should submit not create an eperson when the user info form is invalid', () => {
(ePersonDataService.createEPersonForToken as jasmine.Spy).and.returnValue(createFailedRemoteDataObject$('Error', 500));