mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +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 { NotificationsServiceStub } from '../shared/testing/notifications-service.stub';
|
||||||
import {
|
import {
|
||||||
RegisterEmailFormComponent,
|
RegisterEmailFormComponent,
|
||||||
|
TYPE_REQUEST_REGISTER,
|
||||||
TYPE_REQUEST_FORGOT
|
TYPE_REQUEST_FORGOT
|
||||||
} from './register-email-form.component';
|
} from './register-email-form.component';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../shared/remote-data.utils';
|
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 { GoogleRecaptchaService } from '../core/google-recaptcha/google-recaptcha.service';
|
||||||
import { CookieService } from '../core/services/cookie.service';
|
import { CookieService } from '../core/services/cookie.service';
|
||||||
import { CookieServiceMock } from '../shared/mocks/cookie.service.mock';
|
import { CookieServiceMock } from '../shared/mocks/cookie.service.mock';
|
||||||
|
import { ConfigurationProperty } from '../core/shared/configuration-property.model';
|
||||||
|
|
||||||
describe('RegisterEmailFormComponent', () => {
|
describe('RegisterEmailFormComponent', () => {
|
||||||
|
|
||||||
@@ -113,6 +115,30 @@ describe('RegisterEmailFormComponent', () => {
|
|||||||
comp.form.patchValue({email: 'VALID@email.org'});
|
comp.form.patchValue({email: 'VALID@email.org'});
|
||||||
expect(comp.form.invalid).toBeFalse();
|
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', () => {
|
describe('register', () => {
|
||||||
it('should send a registration to the service and on success display a message and return to home', () => {
|
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