fix issue where iiif tests would fail

This commit is contained in:
Art Lowel
2023-06-08 15:44:30 +02:00
parent 56cba82c2d
commit c9324b0714
2 changed files with 15 additions and 10 deletions

View File

@@ -47,7 +47,7 @@ let bundle;
let comp: EditBitstreamPageComponent; let comp: EditBitstreamPageComponent;
let fixture: ComponentFixture<EditBitstreamPageComponent>; let fixture: ComponentFixture<EditBitstreamPageComponent>;
fdescribe('EditBitstreamPageComponent', () => { describe('EditBitstreamPageComponent', () => {
beforeEach(() => { beforeEach(() => {
bitstreamID = 'current-bitstream-id'; bitstreamID = 'current-bitstream-id';
@@ -223,7 +223,7 @@ fdescribe('EditBitstreamPageComponent', () => {
spyOn(router, 'navigate'); spyOn(router, 'navigate');
}); });
fdescribe('on startup', () => { describe('on startup', () => {
let rawForm; let rawForm;
beforeEach(() => { beforeEach(() => {
@@ -454,13 +454,18 @@ fdescribe('EditBitstreamPageComponent', () => {
self: 'bitstream-selflink' self: 'bitstream-selflink'
}, },
bundle: createSuccessfulRemoteDataObject$({ bundle: createSuccessfulRemoteDataObject$({
_links: {
primaryBitstream: {
href: 'bundle-selflink'
}
},
item: createSuccessfulRemoteDataObject$(Object.assign(new Item(), { item: createSuccessfulRemoteDataObject$(Object.assign(new Item(), {
uuid: 'some-uuid', uuid: 'some-uuid',
firstMetadataValue(keyOrKeys: string | string[], valueFilter?: MetadataValueFilter): string { firstMetadataValue(keyOrKeys: string | string[], valueFilter?: MetadataValueFilter): string {
return 'True'; return 'True';
} }
})) }))
}) }),
}); });
bitstreamService = jasmine.createSpyObj('bitstreamService', { bitstreamService = jasmine.createSpyObj('bitstreamService', {
findById: createSuccessfulRemoteDataObject$(bitstream), findById: createSuccessfulRemoteDataObject$(bitstream),
@@ -574,16 +579,22 @@ fdescribe('EditBitstreamPageComponent', () => {
self: 'bitstream-selflink' self: 'bitstream-selflink'
}, },
bundle: createSuccessfulRemoteDataObject$({ bundle: createSuccessfulRemoteDataObject$({
_links: {
primaryBitstream: {
href: 'bundle-selflink'
}
},
item: createSuccessfulRemoteDataObject$(Object.assign(new Item(), { item: createSuccessfulRemoteDataObject$(Object.assign(new Item(), {
uuid: 'some-uuid', uuid: 'some-uuid',
firstMetadataValue(keyOrKeys: string | string[], valueFilter?: MetadataValueFilter): string { firstMetadataValue(keyOrKeys: string | string[], valueFilter?: MetadataValueFilter): string {
return 'True'; return 'True';
} }
})) }))
}) }),
}); });
bitstreamService = jasmine.createSpyObj('bitstreamService', { bitstreamService = jasmine.createSpyObj('bitstreamService', {
findById: createSuccessfulRemoteDataObject$(bitstream), findById: createSuccessfulRemoteDataObject$(bitstream),
findByHref: createSuccessfulRemoteDataObject$(bitstream),
update: createSuccessfulRemoteDataObject$(bitstream), update: createSuccessfulRemoteDataObject$(bitstream),
updateFormat: createSuccessfulRemoteDataObject$(bitstream), updateFormat: createSuccessfulRemoteDataObject$(bitstream),
commitUpdates: {}, commitUpdates: {},

View File

@@ -401,33 +401,27 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
const bitstream$ = this.bitstreamRD$.pipe( const bitstream$ = this.bitstreamRD$.pipe(
getFirstSucceededRemoteData(), getFirstSucceededRemoteData(),
getRemoteDataPayload(), getRemoteDataPayload(),
tap(t => console.log(t)),
); );
const allFormats$ = this.bitstreamFormatsRD$.pipe( const allFormats$ = this.bitstreamFormatsRD$.pipe(
getFirstSucceededRemoteData(), getFirstSucceededRemoteData(),
getRemoteDataPayload(), getRemoteDataPayload(),
tap(t => console.log(t)),
); );
const bundle$ = bitstream$.pipe( const bundle$ = bitstream$.pipe(
switchMap((bitstream: Bitstream) => bitstream.bundle), switchMap((bitstream: Bitstream) => bitstream.bundle),
getFirstSucceededRemoteDataPayload(), getFirstSucceededRemoteDataPayload(),
tap(t => console.log(t)),
); );
const primaryBitstream$ = bundle$.pipe( const primaryBitstream$ = bundle$.pipe(
hasValueOperator(), hasValueOperator(),
tap(t => console.log(t._links.primaryBitstream.href)),
switchMap((bundle: Bundle) => this.bitstreamService.findByHref(bundle._links.primaryBitstream.href)), switchMap((bundle: Bundle) => this.bitstreamService.findByHref(bundle._links.primaryBitstream.href)),
getFirstSucceededRemoteDataPayload(), getFirstSucceededRemoteDataPayload(),
tap(t => console.log(t)),
); );
const item$ = bundle$.pipe( const item$ = bundle$.pipe(
switchMap((bundle: Bundle) => bundle.item), switchMap((bundle: Bundle) => bundle.item),
getFirstSucceededRemoteDataPayload(), getFirstSucceededRemoteDataPayload(),
tap(t => console.log(t)),
); );
this.subs.push( this.subs.push(
observableCombineLatest( observableCombineLatest(