Skip to content

Commit 12a3b4f

Browse files
committed
always use thumbnail component for files not supported by the media viewer, and switch to themed version of thumbnail component
1 parent 9e8c0dc commit 12a3b4f

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/app/item-page/media-viewer/media-viewer.component.spec.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NO_ERRORS_SCHEMA } from '@angular/core';
1+
import { NO_ERRORS_SCHEMA, PLATFORM_ID } from '@angular/core';
22
import {
33
ComponentFixture,
44
TestBed,
@@ -27,10 +27,17 @@ import { ThemeService } from '../../shared/theme-support/theme.service';
2727
import { FileSizePipe } from '../../shared/utils/file-size-pipe';
2828
import { VarDirective } from '../../shared/utils/var.directive';
2929
import { 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

3135
describe('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

Comments
 (0)