always use thumbnail component for files not supported by the media viewer, and switch to themed version of thumbnail component

This commit is contained in:
Art Lowel
2025-05-08 11:26:14 +02:00
parent 9e8c0dc262
commit 12a3b4f846

View File

@@ -1,4 +1,4 @@
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { NO_ERRORS_SCHEMA, PLATFORM_ID } from '@angular/core';
import {
ComponentFixture,
TestBed,
@@ -27,10 +27,17 @@ import { ThemeService } from '../../shared/theme-support/theme.service';
import { FileSizePipe } from '../../shared/utils/file-size-pipe';
import { VarDirective } from '../../shared/utils/var.directive';
import { MediaViewerComponent } from './media-viewer.component';
import {
AuthorizationDataService
} from '../../core/data/feature-authorization/authorization-data.service';
import { FileService } from '../../core/shared/file.service';
describe('MediaViewerComponent', () => {
let comp: MediaViewerComponent;
let fixture: ComponentFixture<MediaViewerComponent>;
let authService;
let authorizationService;
let fileService;
const mockBitstream: Bitstream = Object.assign(new Bitstream(), {
sizeBytes: 10201,
@@ -73,6 +80,15 @@ describe('MediaViewerComponent', () => {
);
beforeEach(waitForAsync(() => {
authService = jasmine.createSpyObj('AuthService', {
isAuthenticated: observableOf(true),
});
authorizationService = jasmine.createSpyObj('AuthorizationService', {
isAuthorized: observableOf(true),
});
fileService = jasmine.createSpyObj('FileService', {
retrieveFileDownloadLink: null,
});
return TestBed.configureTestingModule({
imports: [
TranslateModule.forRoot({
@@ -88,6 +104,10 @@ describe('MediaViewerComponent', () => {
MetadataFieldWrapperComponent,
],
providers: [
{ provide: AuthService, useValue: authService },
{ provide: AuthorizationDataService, useValue: authorizationService },
{ provide: FileService, useValue: fileService },
{ provide: PLATFORM_ID, useValue: 'browser' },
{ provide: BitstreamDataService, useValue: bitstreamDataService },
{ provide: ThemeService, useValue: getMockThemeService() },
{ provide: AuthService, useValue: new AuthServiceMock() },