Clean up test.

This commit is contained in:
Michael Spalti
2021-12-06 12:56:13 -08:00
parent b4b17136a6
commit c112a036df

View File

@@ -42,7 +42,7 @@ let fixture: ComponentFixture<EditBitstreamPageComponent>;
describe('EditBitstreamPageComponent', () => { describe('EditBitstreamPageComponent', () => {
beforeEach(waitForAsync(() => { beforeEach(() => {
allFormats = [ allFormats = [
Object.assign({ Object.assign({
id: '1', id: '1',
@@ -73,13 +73,7 @@ describe('EditBitstreamPageComponent', () => {
}) })
] as BitstreamFormat[]; ] as BitstreamFormat[];
selectedFormat = allFormats[1]; selectedFormat = allFormats[1];
notificationsService = jasmine.createSpyObj('notificationsService',
{
info: infoNotification,
warning: warningNotification,
success: successNotification
}
);
formService = Object.assign({ formService = Object.assign({
createFormGroup: (fModel: DynamicFormControlModel[]) => { createFormGroup: (fModel: DynamicFormControlModel[]) => {
const controls = {}; const controls = {};
@@ -92,6 +86,24 @@ describe('EditBitstreamPageComponent', () => {
return undefined; return undefined;
} }
}); });
bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', {
findAll: createSuccessfulRemoteDataObject$(createPaginatedList(allFormats))
});
notificationsService = jasmine.createSpyObj('notificationsService',
{
info: infoNotification,
warning: warningNotification,
success: successNotification
}
);
});
describe('EditBitstreamPageComponent no IIIF fields', () => {
beforeEach(waitForAsync(() => {
bitstream = Object.assign(new Bitstream(), { bitstream = Object.assign(new Bitstream(), {
metadata: { metadata: {
'dc.description': [ 'dc.description': [
@@ -252,18 +264,11 @@ describe('EditBitstreamPageComponent', () => {
expect(router.navigate).toHaveBeenCalledWith([getEntityEditRoute(null, 'some-uuid'), 'bitstreams']); expect(router.navigate).toHaveBeenCalledWith([getEntityEditRoute(null, 'some-uuid'), 'bitstreams']);
}); });
}); });
}); });
describe('EditBitstreamPageComponent with IIIF', () => { describe('EditBitstreamPageComponent with IIIF fields', () => {
beforeEach(waitForAsync(() => { beforeEach(waitForAsync(() => {
bitstreamService = jasmine.createSpyObj('bitstreamService', {
findById: createSuccessfulRemoteDataObject$(bitstream),
update: createSuccessfulRemoteDataObject$(bitstream),
updateFormat: createSuccessfulRemoteDataObject$(bitstream),
commitUpdates: {},
patch: {}
});
bitstream = Object.assign(new Bitstream(), { bitstream = Object.assign(new Bitstream(), {
metadata: { metadata: {
'dc.description': [ 'dc.description': [
@@ -381,4 +386,5 @@ describe('EditBitstreamPageComponent with IIIF', () => {
expect(rawForm.iiifHeightContainer.iiifHeight).toEqual('2800'); expect(rawForm.iiifHeightContainer.iiifHeight).toEqual('2800');
}); });
}); });
});
}); });