mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Merge remote-tracking branch 'atmire/w2p-97298_issue-3281_self-register-issue-7.2' into w2p-97298_issue-3281_self-register-issue-main
# Conflicts: # src/app/register-email-form/register-email-form.component.spec.ts
This commit is contained in:
@@ -14,6 +14,7 @@ import { RouterStub } from '../shared/testing/router.stub';
|
||||
import { NotificationsServiceStub } from '../shared/testing/notifications-service.stub';
|
||||
import {
|
||||
RegisterEmailFormComponent,
|
||||
TYPE_REQUEST_REGISTER,
|
||||
TYPE_REQUEST_FORGOT
|
||||
} from './register-email-form.component';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../shared/remote-data.utils';
|
||||
@@ -21,6 +22,7 @@ import { ConfigurationDataService } from '../core/data/configuration-data.servic
|
||||
import { GoogleRecaptchaService } from '../core/google-recaptcha/google-recaptcha.service';
|
||||
import { CookieService } from '../core/services/cookie.service';
|
||||
import { CookieServiceMock } from '../shared/mocks/cookie.service.mock';
|
||||
import { ConfigurationProperty } from '../core/shared/configuration-property.model';
|
||||
|
||||
describe('RegisterEmailFormComponent', () => {
|
||||
|
||||
@@ -113,6 +115,30 @@ describe('RegisterEmailFormComponent', () => {
|
||||
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',
|
||||
values: ['marvel.com'],
|
||||
})));
|
||||
comp.typeRequest = TYPE_REQUEST_REGISTER;
|
||||
|
||||
comp.ngOnInit();
|
||||
|
||||
comp.form.patchValue({ email: 'valid@email.org' });
|
||||
expect(comp.form.invalid).toBeTrue();
|
||||
});
|
||||
it('should accept email with the given domain name', () => {
|
||||
spyOn(configurationDataService, 'findByPropertyName').and.returnValue(createSuccessfulRemoteDataObject$(Object.assign(new ConfigurationProperty(), {
|
||||
name: 'authentication-password.domain.valid',
|
||||
values: ['marvel.com'],
|
||||
})));
|
||||
comp.typeRequest = TYPE_REQUEST_REGISTER;
|
||||
|
||||
comp.ngOnInit();
|
||||
|
||||
comp.form.patchValue({ email: 'thor.odinson@marvel.com' });
|
||||
expect(comp.form.invalid).toBeFalse();
|
||||
});
|
||||
});
|
||||
describe('register', () => {
|
||||
it('should send a registration to the service and on success display a message and return to home', () => {
|
||||
|
Reference in New Issue
Block a user