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
This commit is contained in:
Jens Vannerum
2022-03-17 11:49:53 +01:00
parent f00664b281
commit 8d7d65958d

View File

@@ -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));
});
});
});