mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 22:13:02 +00:00
68346: Test fixes
This commit is contained in:
@@ -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', () => {
|
||||||
|
@@ -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) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -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>;
|
||||||
|
|
||||||
|
@@ -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();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -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);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user