1- import { NO_ERRORS_SCHEMA } from '@angular/core' ;
1+ import { NO_ERRORS_SCHEMA , PLATFORM_ID } from '@angular/core' ;
22import {
33 ComponentFixture ,
44 TestBed ,
@@ -27,10 +27,17 @@ import { ThemeService } from '../../shared/theme-support/theme.service';
2727import { FileSizePipe } from '../../shared/utils/file-size-pipe' ;
2828import { VarDirective } from '../../shared/utils/var.directive' ;
2929import { MediaViewerComponent } from './media-viewer.component' ;
30+ import {
31+ AuthorizationDataService
32+ } from '../../core/data/feature-authorization/authorization-data.service' ;
33+ import { FileService } from '../../core/shared/file.service' ;
3034
3135describe ( 'MediaViewerComponent' , ( ) => {
3236 let comp : MediaViewerComponent ;
3337 let fixture : ComponentFixture < MediaViewerComponent > ;
38+ let authService ;
39+ let authorizationService ;
40+ let fileService ;
3441
3542 const mockBitstream : Bitstream = Object . assign ( new Bitstream ( ) , {
3643 sizeBytes : 10201 ,
@@ -73,6 +80,15 @@ describe('MediaViewerComponent', () => {
7380 ) ;
7481
7582 beforeEach ( waitForAsync ( ( ) => {
83+ authService = jasmine . createSpyObj ( 'AuthService' , {
84+ isAuthenticated : observableOf ( true ) ,
85+ } ) ;
86+ authorizationService = jasmine . createSpyObj ( 'AuthorizationService' , {
87+ isAuthorized : observableOf ( true ) ,
88+ } ) ;
89+ fileService = jasmine . createSpyObj ( 'FileService' , {
90+ retrieveFileDownloadLink : null ,
91+ } ) ;
7692 return TestBed . configureTestingModule ( {
7793 imports : [
7894 TranslateModule . forRoot ( {
@@ -88,6 +104,10 @@ describe('MediaViewerComponent', () => {
88104 MetadataFieldWrapperComponent ,
89105 ] ,
90106 providers : [
107+ { provide : AuthService , useValue : authService } ,
108+ { provide : AuthorizationDataService , useValue : authorizationService } ,
109+ { provide : FileService , useValue : fileService } ,
110+ { provide : PLATFORM_ID , useValue : 'browser' } ,
91111 { provide : BitstreamDataService , useValue : bitstreamDataService } ,
92112 { provide : ThemeService , useValue : getMockThemeService ( ) } ,
93113 { provide : AuthService , useValue : new AuthServiceMock ( ) } ,
0 commit comments