From 8d7d65958da163bc835b7b57a47d0b5dea8e85ff Mon Sep 17 00:00:00 2001 From: Jens Vannerum Date: Thu, 17 Mar 2022 11:49:53 +0100 Subject: [PATCH] 88507 Added a second test - This test checks that the downloadUrl prop is not set to `bitstream._links.content.href` (the bug that's fixed) - And checks that it's set to the correct download route of the bitstream --- .../item-edit-bitstream.component.spec.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.spec.ts b/src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.spec.ts index ddc807a71f..0313bac721 100644 --- a/src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.spec.ts +++ b/src/app/item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.spec.ts @@ -31,6 +31,10 @@ const bitstream = Object.assign(new Bitstream(), { name: 'Fake Bitstream', bundleName: 'ORIGINAL', description: 'Description', + _links: { + content: { href: 'content-link' } + }, + format: createSuccessfulRemoteDataObject$(format) }); const fieldUpdate = { @@ -120,10 +124,17 @@ describe('ItemEditBitstreamComponent', () => { }); describe('when the component loads', () => { - it('the download button should contain the link to the bitstreams download page', () => { + it('should contain download button with a valid link to the bitstreams download page', () => { fixture.detectChanges(); const downloadBtnHref = fixture.debugElement.query(By.css('[data-test="download-button"]')).nativeElement.getAttribute('href'); expect(downloadBtnHref).toEqual(comp.bitstreamDownloadUrl); }); }); + + describe('when the bitstreamDownloadUrl property gets populated', () => { + it('should contain the bitstream download page route', () => { + expect(comp.bitstreamDownloadUrl).not.toEqual(bitstream._links.content.href); + expect(comp.bitstreamDownloadUrl).toEqual(getBitstreamDownloadRoute(bitstream)); + }); + }); });