@@ -35,7 +35,10 @@ import { createPaginatedList } from '../testing/utils.test';
3535import { ItemSearchResult } from '../object-collection/shared/item-search-result.model' ;
3636import { BitstreamFormat } from '../../core/shared/bitstream-format.model' ;
3737import { CarouselOptions } from './carousel-options.model' ;
38- import { InternalLinkService } from 'src/app/core/services/internal-link.service' ;
38+ import { SortDirection } from '../../core/cache/models/sort-options.model' ;
39+ import { SearchManager } from '../../core/browse/search-manager' ;
40+ import { toRemoteData } from '../../browse-by/browse-by-metadata-page/browse-by-metadata-page.component.spec' ;
41+ import { InternalLinkService } from '../../core/services/internal-link.service' ;
3942
4043describe ( 'CarouselComponent' , ( ) => {
4144 let component : CarouselComponent ;
@@ -64,7 +67,12 @@ describe('CarouselComponent', () => {
6467 aspectRatio : 1 ,
6568 captionStyle : '' ,
6669 titleStyle : '' ,
67- bundle : 'ORIGINAL'
70+ bundle : 'ORIGINAL' ,
71+ discoveryConfiguration : 'person' ,
72+ sortField : 'testField' ,
73+ sortDirection : SortDirection . DESC ,
74+ numberOfItems : 5 ,
75+ order : 'testOrder'
6876 } ;
6977
7078 const firstItemResult = Object . assign ( new ItemSearchResult ( ) , {
@@ -154,6 +162,10 @@ describe('CarouselComponent', () => {
154162 } ) )
155163 } ) ;
156164
165+ const mockSearchManager = {
166+ search : ( options : any ) => toRemoteData ( [ firstItemResult ] )
167+ } ;
168+
157169 beforeEach ( waitForAsync ( ( ) => {
158170 notificationService = new NotificationsServiceStub ( ) ;
159171 TestBed . configureTestingModule ( {
@@ -169,8 +181,8 @@ describe('CarouselComponent', () => {
169181 providers : [
170182 CarouselComponent ,
171183 { provide : ObjectCacheService , useValue : { } } ,
172- { provide : InternalLinkService , useValue : { } } ,
173- { provide : UUIDService , useValue : { } } ,
184+ { provide : InternalLinkService , useValue : { } } ,
185+ { provide : UUIDService , useValue : { } } ,
174186 { provide : Store , useValue : { } } ,
175187 { provide : RemoteDataBuildService , useValue : { } } ,
176188 { provide : HALEndpointService , useValue : { } } ,
@@ -180,6 +192,7 @@ describe('CarouselComponent', () => {
180192 { provide : DefaultChangeAnalyzer , useValue : { } } ,
181193 { provide : BitstreamDataService , useValue : mockBitstreamDataService } ,
182194 { provide : NativeWindowService , useValue : new NativeWindowRef ( ) } ,
195+ { provide : SearchManager , useValue : mockSearchManager } ,
183196 ] ,
184197 schemas : [ NO_ERRORS_SCHEMA ]
185198 } ) . compileComponents ( ) ;
@@ -190,7 +203,6 @@ describe('CarouselComponent', () => {
190203 fixture = TestBed . createComponent ( CarouselComponent ) ;
191204 component = fixture . componentInstance ;
192205 mockBitstreamDataService . findAllByItemAndBundleName . and . returnValue ( createSuccessfulRemoteDataObject$ ( createPaginatedList ( [ mockBitstream1 ] ) ) ) ;
193- component . items = [ firstItemResult ] ;
194206 component . carouselOptions = carouselOptions ;
195207
196208 fixture . detectChanges ( ) ;
@@ -224,7 +236,6 @@ describe('CarouselComponent', () => {
224236 fixture = TestBed . createComponent ( CarouselComponent ) ;
225237 component = fixture . componentInstance ;
226238 mockBitstreamDataService . findAllByItemAndBundleName . and . returnValue ( createSuccessfulRemoteDataObject$ ( createPaginatedList ( [ mockBitstream2 ] ) ) ) ;
227- component . items = [ secondItemResult ] ;
228239 component . carouselOptions = carouselOptions ;
229240
230241 fixture . detectChanges ( ) ;
0 commit comments