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', () => {
expect(rawForm.descriptionContainer.description).toEqual(bitstream.description);
expect(rawForm.descriptionContainer.description).toEqual(bitstream.firstMetadataValue('dc.description'));
});
it('should select the correct format', () => {

View File

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

View File

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

View File

@@ -146,7 +146,7 @@ describe('ItemBitstreamsComponent', () => {
url: url
});
bundleService = jasmine.createSpyObj('bundleService', {
immediatePatch: observableOf(new RestResponse(true, 200, 'OK'))
patch: observableOf(new RestResponse(true, 200, 'OK'))
});
TestBed.configureTestingModule({
@@ -192,7 +192,7 @@ describe('ItemBitstreamsComponent', () => {
});
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', () => {
let operations;
let selfLink;
const dso = {
uuid: 'dso-uuid'
};
const operations = [
Object.assign({
op: 'move',
from: '/1',
path: '/5'
}) as Operation
];
beforeEach(() => {
operations = [{ op: 'replace', path: '/metadata/dc.title', value: 'random string' } as Operation];
selfLink = 'https://rest.api/endpoint/1698f1d3-be98-4c51-9fd8-6bfedcbd59b7';
spyOn(objectCache, 'addPatch');
service.patch(dso, operations);
});
it('should call addPatch on the object cache with the right parameters', () => {
service.patch(selfLink, operations);
expect(objectCache.addPatch).toHaveBeenCalledWith(selfLink, operations);
it('should configure a PatchRequest', () => {
expect(requestService.configure).toHaveBeenCalledWith(jasmine.any(PatchRequest));
});
});