From 5d2f63ff65ca28948b3bd5359db63e8a3cc3d813 Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Wed, 8 Feb 2023 10:17:36 +0100 Subject: [PATCH] 99053: Added test to check that the TYPE_REQUEST_FORGOT doesn't use the authentication-password.domain.valid --- .../register-email-form.component.spec.ts | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/app/register-email-form/register-email-form.component.spec.ts b/src/app/register-email-form/register-email-form.component.spec.ts index 4fea169e35..89af6ff05a 100644 --- a/src/app/register-email-form/register-email-form.component.spec.ts +++ b/src/app/register-email-form/register-email-form.component.spec.ts @@ -74,15 +74,6 @@ describe('RegisterEmailFormComponent', () => { const elem = fixture.debugElement.queryAll(By.css('input#email'))[0].nativeElement; expect(elem).toBeDefined(); }); - - it('should not retrieve the validDomains for TYPE_REQUEST_FORGOT', () => { - spyOn(configurationDataService, 'findByPropertyName'); - comp.typeRequest = TYPE_REQUEST_FORGOT; - - comp.ngOnInit(); - - expect(configurationDataService.findByPropertyName).not.toHaveBeenCalled(); - }); }); describe('email validation', () => { it('should be invalid when no email is present', () => { @@ -96,6 +87,18 @@ describe('RegisterEmailFormComponent', () => { comp.form.patchValue({email: 'valid@email.org'}); expect(comp.form.invalid).toBeFalse(); }); + it('should accept email with other domain names on TYPE_REQUEST_FORGOT form', () => { + spyOn(configurationDataService, 'findByPropertyName').and.returnValue(createSuccessfulRemoteDataObject$(Object.assign(new ConfigurationProperty(), { + name: 'authentication-password.domain.valid', + values: ['marvel.com'], + }))); + comp.typeRequest = TYPE_REQUEST_FORGOT; + + comp.ngOnInit(); + + comp.form.patchValue({ email: 'valid@email.org' }); + expect(comp.form.invalid).toBeFalse(); + }); it('should not accept email with other domain names', () => { spyOn(configurationDataService, 'findByPropertyName').and.returnValue(createSuccessfulRemoteDataObject$(Object.assign(new ConfigurationProperty(), { name: 'authentication-password.domain.valid',