mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-12 04:23:04 +00:00
83681: fixed bundles issue on update bitstreams edit item page
This commit is contained in:
@@ -21,6 +21,7 @@ import { createPaginatedList } from '../../../shared/testing/utils.test';
|
|||||||
import { RouterStub } from '../../../shared/testing/router.stub';
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
import { AuthServiceStub } from '../../../shared/testing/auth-service.stub';
|
import { AuthServiceStub } from '../../../shared/testing/auth-service.stub';
|
||||||
|
import { getTestScheduler } from 'jasmine-marbles';
|
||||||
|
|
||||||
describe('UploadBistreamComponent', () => {
|
describe('UploadBistreamComponent', () => {
|
||||||
let comp: UploadBitstreamComponent;
|
let comp: UploadBitstreamComponent;
|
||||||
@@ -76,7 +77,8 @@ describe('UploadBistreamComponent', () => {
|
|||||||
const restEndpoint = 'fake-rest-endpoint';
|
const restEndpoint = 'fake-rest-endpoint';
|
||||||
const mockItemDataService = jasmine.createSpyObj('mockItemDataService', {
|
const mockItemDataService = jasmine.createSpyObj('mockItemDataService', {
|
||||||
getBitstreamsEndpoint: observableOf(restEndpoint),
|
getBitstreamsEndpoint: observableOf(restEndpoint),
|
||||||
createBundle: createSuccessfulRemoteDataObject$(createdBundle)
|
createBundle: createSuccessfulRemoteDataObject$(createdBundle),
|
||||||
|
getBundles: createSuccessfulRemoteDataObject$([bundle])
|
||||||
});
|
});
|
||||||
const bundleService = jasmine.createSpyObj('bundleService', {
|
const bundleService = jasmine.createSpyObj('bundleService', {
|
||||||
getBitstreamsEndpoint: observableOf(restEndpoint),
|
getBitstreamsEndpoint: observableOf(restEndpoint),
|
||||||
@@ -92,6 +94,22 @@ describe('UploadBistreamComponent', () => {
|
|||||||
removeByHrefSubstring: {}
|
removeByHrefSubstring: {}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
describe('on init', () => {
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
createUploadBitstreamTestingModule({
|
||||||
|
bundle: bundle.id
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
beforeEach(() => {
|
||||||
|
loadFixtureAndComp();
|
||||||
|
});
|
||||||
|
it('should initialize the bundles', () => {
|
||||||
|
expect(comp.bundlesRD$).toBeDefined();
|
||||||
|
getTestScheduler().expectObservable(comp.bundlesRD$).toBe('(a|)', {a: createSuccessfulRemoteDataObject([bundle])});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('when a file is uploaded', () => {
|
describe('when a file is uploaded', () => {
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
createUploadBitstreamTestingModule({});
|
createUploadBitstreamTestingModule({});
|
||||||
|
@@ -108,9 +108,7 @@ export class UploadBitstreamComponent implements OnInit, OnDestroy {
|
|||||||
this.itemId = this.route.snapshot.params.id;
|
this.itemId = this.route.snapshot.params.id;
|
||||||
this.entityType = this.route.snapshot.params['entity-type'];
|
this.entityType = this.route.snapshot.params['entity-type'];
|
||||||
this.itemRD$ = this.route.data.pipe(map((data) => data.dso));
|
this.itemRD$ = this.route.data.pipe(map((data) => data.dso));
|
||||||
this.bundlesRD$ = this.itemRD$.pipe(
|
this.bundlesRD$ = this.itemService.getBundles(this.itemId);
|
||||||
switchMap((itemRD: RemoteData<Item>) => itemRD.payload.bundles)
|
|
||||||
);
|
|
||||||
this.selectedBundleId = this.route.snapshot.queryParams.bundle;
|
this.selectedBundleId = this.route.snapshot.queryParams.bundle;
|
||||||
if (isNotEmpty(this.selectedBundleId)) {
|
if (isNotEmpty(this.selectedBundleId)) {
|
||||||
this.bundleService.findById(this.selectedBundleId).pipe(
|
this.bundleService.findById(this.selectedBundleId).pipe(
|
||||||
|
Reference in New Issue
Block a user