@@ -2,7 +2,9 @@ import { CommonModule } from '@angular/common';
22import { NO_ERRORS_SCHEMA } from '@angular/core' ;
33import {
44 ComponentFixture ,
5+ fakeAsync ,
56 TestBed ,
7+ tick ,
68 waitForAsync ,
79} from '@angular/core/testing' ;
810import {
@@ -63,7 +65,10 @@ import { NotificationsServiceStub } from '../../../shared/testing/notifications-
6365import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub' ;
6466import { RouterStub } from '../../../shared/testing/router.stub' ;
6567import { createPaginatedList } from '../../../shared/testing/utils.test' ;
66- import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model' ;
68+ import {
69+ followLink ,
70+ FollowLinkConfig ,
71+ } from '../../../shared/utils/follow-link-config.model' ;
6772import { HasNoValuePipe } from '../../../shared/utils/has-no-value.pipe' ;
6873import { EPeopleRegistryComponent } from '../epeople-registry.component' ;
6974import { EPersonFormComponent } from './eperson-form.component' ;
@@ -576,4 +581,15 @@ describe('EPersonFormComponent', () => {
576581 expect ( epersonRegistrationService . registerEmail ) . toHaveBeenCalledWith ( ePersonEmail , null , 'forgot' ) ;
577582 } ) ;
578583 } ) ;
584+
585+ describe ( 'findListByHref functionality' , ( ) => {
586+ it ( 'retrieves groups and object on page change' , fakeAsync ( ( ) => {
587+ spyOn ( ePersonDataServiceStub , 'getActiveEPerson' ) . and . returnValue ( observableOf ( { _links : { groups : { href : 'groups' } } } as EPerson ) ) ;
588+
589+ const options = { currentPage : 1 , elementsPerPage : 5 } ;
590+ component . onPageChange ( options . currentPage ) ;
591+ tick ( ) ;
592+ expect ( groupsDataService . findListByHref ) . toHaveBeenCalledWith ( jasmine . anything ( ) , options , undefined , undefined , followLink ( 'object' ) ) ;
593+ } ) ) ;
594+ } ) ;
579595} ) ;
0 commit comments