68346: Test fixes

This commit is contained in:
Kristof De Langhe
2020-03-14 15:13:27 +01:00
parent ed2c935f7e
commit 5849499569
5 changed files with 18 additions and 16 deletions

View File

@@ -152,7 +152,7 @@ describe('EditBitstreamPageComponent', () => {
}); });
it('should fill in the bitstream\'s description', () => { it('should fill in the bitstream\'s description', () => {
expect(rawForm.descriptionContainer.description).toEqual(bitstream.description); expect(rawForm.descriptionContainer.description).toEqual(bitstream.firstMetadataValue('dc.description'));
}); });
it('should select the correct format', () => { it('should select the correct format', () => {

View File

@@ -275,9 +275,7 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
private translate: TranslateService, private translate: TranslateService,
private bitstreamService: BitstreamDataService, private bitstreamService: BitstreamDataService,
private notificationsService: NotificationsService, private notificationsService: NotificationsService,
private bitstreamFormatService: BitstreamFormatDataService, private bitstreamFormatService: BitstreamFormatDataService) {
private objectCache: ObjectCacheService,
private requestService: RequestService) {
} }
/** /**

View File

@@ -23,9 +23,8 @@ import { VarDirective } from '../../../shared/utils/var.directive';
import { Bitstream } from '../../../core/shared/bitstream.model'; import { Bitstream } from '../../../core/shared/bitstream.model';
import { BundleDataService } from '../../../core/data/bundle-data.service'; import { BundleDataService } from '../../../core/data/bundle-data.service';
import { Bundle } from '../../../core/shared/bundle.model'; import { Bundle } from '../../../core/shared/bundle.model';
import { By } from '@angular/platform-browser';
fdescribe('UploadBistreamComponent', () => { describe('UploadBistreamComponent', () => {
let comp: UploadBitstreamComponent; let comp: UploadBitstreamComponent;
let fixture: ComponentFixture<UploadBitstreamComponent>; let fixture: ComponentFixture<UploadBitstreamComponent>;

View File

@@ -146,7 +146,7 @@ describe('ItemBitstreamsComponent', () => {
url: url url: url
}); });
bundleService = jasmine.createSpyObj('bundleService', { bundleService = jasmine.createSpyObj('bundleService', {
immediatePatch: observableOf(new RestResponse(true, 200, 'OK')) patch: observableOf(new RestResponse(true, 200, 'OK'))
}); });
TestBed.configureTestingModule({ TestBed.configureTestingModule({
@@ -192,7 +192,7 @@ describe('ItemBitstreamsComponent', () => {
}); });
it('should send out a patch for the move operations', () => { it('should send out a patch for the move operations', () => {
expect(bundleService.immediatePatch).toHaveBeenCalled(); expect(bundleService.patch).toHaveBeenCalled();
}); });
}); });

View File

@@ -287,18 +287,23 @@ describe('DataService', () => {
}); });
describe('patch', () => { describe('patch', () => {
let operations; const dso = {
let selfLink; uuid: 'dso-uuid'
};
const operations = [
Object.assign({
op: 'move',
from: '/1',
path: '/5'
}) as Operation
];
beforeEach(() => { beforeEach(() => {
operations = [{ op: 'replace', path: '/metadata/dc.title', value: 'random string' } as Operation]; service.patch(dso, operations);
selfLink = 'https://rest.api/endpoint/1698f1d3-be98-4c51-9fd8-6bfedcbd59b7';
spyOn(objectCache, 'addPatch');
}); });
it('should call addPatch on the object cache with the right parameters', () => { it('should configure a PatchRequest', () => {
service.patch(selfLink, operations); expect(requestService.configure).toHaveBeenCalledWith(jasmine.any(PatchRequest));
expect(objectCache.addPatch).toHaveBeenCalledWith(selfLink, operations);
}); });
}); });