Skip to content

Commit 28fe5ae

Browse files
committed
115491: Fix test after refactor
1 parent ff2fbf1 commit 28fe5ae

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ describe('EditBitstreamPageComponent', () => {
102102
});
103103

104104
bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', {
105-
findAll: createSuccessfulRemoteDataObject$(createPaginatedList(allFormats))
105+
findAll: createSuccessfulRemoteDataObject$(createPaginatedList(allFormats)),
106+
findByHref: createSuccessfulRemoteDataObject$(selectedFormat),
106107
});
107108

108109
notificationsService = jasmine.createSpyObj('notificationsService',
@@ -138,6 +139,7 @@ describe('EditBitstreamPageComponent', () => {
138139
});
139140

140141
describe('EditBitstreamPageComponent no IIIF fields', () => {
142+
const dsoNameServiceReturnValue = 'ORIGINAL';
141143

142144
beforeEach(waitForAsync(() => {
143145
bundle = {
@@ -153,7 +155,6 @@ describe('EditBitstreamPageComponent', () => {
153155
},
154156
}))
155157
};
156-
const bundleName = 'ORIGINAL';
157158

158159
bitstream = Object.assign(new Bitstream(), {
159160
uuid: bitstreamID,
@@ -172,7 +173,8 @@ describe('EditBitstreamPageComponent', () => {
172173
},
173174
format: createSuccessfulRemoteDataObject$(selectedFormat),
174175
_links: {
175-
self: 'bitstream-selflink'
176+
self: 'bitstream-selflink',
177+
format: 'format-link',
176178
},
177179
bundle: createSuccessfulRemoteDataObject$(bundle)
178180
});
@@ -185,10 +187,11 @@ describe('EditBitstreamPageComponent', () => {
185187
patch: {}
186188
});
187189
bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', {
188-
findAll: createSuccessfulRemoteDataObject$(createPaginatedList(allFormats))
190+
findAll: createSuccessfulRemoteDataObject$(createPaginatedList(allFormats)),
191+
findByHref: createSuccessfulRemoteDataObject$(selectedFormat),
189192
});
190193
dsoNameService = jasmine.createSpyObj('dsoNameService', {
191-
getName: bundleName
194+
getName: dsoNameServiceReturnValue,
192195
});
193196

194197
TestBed.configureTestingModule({
@@ -231,7 +234,7 @@ describe('EditBitstreamPageComponent', () => {
231234
});
232235

233236
it('should fill in the bitstream\'s title', () => {
234-
expect(rawForm.fileNamePrimaryContainer.fileName).toEqual(bitstream.name);
237+
expect(rawForm.fileNamePrimaryContainer.fileName).toEqual(dsoNameServiceReturnValue);
235238
});
236239

237240
it('should fill in the bitstream\'s description', () => {
@@ -403,7 +406,7 @@ describe('EditBitstreamPageComponent', () => {
403406
});
404407
describe('when navigateToItemEditBitstreams is called', () => {
405408
it('should redirect to the item edit page on the bitstreams tab with the itemId from the component', () => {
406-
comp.itemId = 'some-uuid1';
409+
comp.item.uuid = 'some-uuid1';
407410
comp.navigateToItemEditBitstreams();
408411
expect(router.navigate).toHaveBeenCalledWith([getEntityEditRoute(null, 'some-uuid1'), 'bitstreams']);
409412
});
@@ -451,7 +454,8 @@ describe('EditBitstreamPageComponent', () => {
451454
},
452455
format: createSuccessfulRemoteDataObject$(allFormats[1]),
453456
_links: {
454-
self: 'bitstream-selflink'
457+
self: 'bitstream-selflink',
458+
format: 'format-link',
455459
},
456460
bundle: createSuccessfulRemoteDataObject$({
457461
_links: {
@@ -576,7 +580,8 @@ describe('EditBitstreamPageComponent', () => {
576580
},
577581
format: createSuccessfulRemoteDataObject$(allFormats[2]),
578582
_links: {
579-
self: 'bitstream-selflink'
583+
self: 'bitstream-selflink',
584+
format: 'format-link',
580585
},
581586
bundle: createSuccessfulRemoteDataObject$({
582587
_links: {

0 commit comments

Comments
 (0)