mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
update test
This commit is contained in:
@@ -266,7 +266,7 @@ describe('ItemRelationshipsComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('it should delete the correct relationship', () => {
|
it('it should delete the correct relationship', () => {
|
||||||
expect(relationshipService.deleteRelationship).toHaveBeenCalledWith(relationships[1].uuid, 'left');
|
expect(relationshipService.deleteRelationship).toHaveBeenCalledWith(relationships[1].uuid, 'left', false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -4,11 +4,9 @@ import {
|
|||||||
DeleteRelationship,
|
DeleteRelationship,
|
||||||
RelationshipIdentifiable,
|
RelationshipIdentifiable,
|
||||||
} from '../../../core/data/object-updates/object-updates.reducer';
|
} from '../../../core/data/object-updates/object-updates.reducer';
|
||||||
import { map, startWith, switchMap, take, concatMap, toArray, tap } from 'rxjs/operators';
|
import { map, switchMap, take, concatMap, toArray } from 'rxjs/operators';
|
||||||
import {
|
import {
|
||||||
combineLatest as observableCombineLatest,
|
combineLatest as observableCombineLatest,
|
||||||
of as observableOf,
|
|
||||||
zip as observableZip,
|
|
||||||
Observable,
|
Observable,
|
||||||
BehaviorSubject, EMPTY
|
BehaviorSubject, EMPTY
|
||||||
} from 'rxjs';
|
} from 'rxjs';
|
||||||
@@ -36,7 +34,6 @@ import { FieldChangeType } from '../../../core/data/object-updates/field-change-
|
|||||||
import { RelationshipTypeDataService } from '../../../core/data/relationship-type-data.service';
|
import { RelationshipTypeDataService } from '../../../core/data/relationship-type-data.service';
|
||||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { HALLink } from '../../../core/shared/hal-link.model';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-item-relationships',
|
selector: 'ds-item-relationships',
|
||||||
@@ -144,7 +141,7 @@ export class ItemRelationshipsComponent extends AbstractItemUpdateComponent {
|
|||||||
switchMap(([removeUpdates, addUpdates]) => [...removeUpdates, ...addUpdates]),
|
switchMap(([removeUpdates, addUpdates]) => [...removeUpdates, ...addUpdates]),
|
||||||
concatMap((update: FieldUpdate) => {
|
concatMap((update: FieldUpdate) => {
|
||||||
if (update.changeType === FieldChangeType.REMOVE) {
|
if (update.changeType === FieldChangeType.REMOVE) {
|
||||||
return this.deleteRelationship(update.field as DeleteRelationship).pipe(take(1))
|
return this.deleteRelationship(update.field as DeleteRelationship).pipe(take(1));
|
||||||
} else if (update.changeType === FieldChangeType.ADD) {
|
} else if (update.changeType === FieldChangeType.ADD) {
|
||||||
return this.addRelationship(update.field as RelationshipIdentifiable).pipe(
|
return this.addRelationship(update.field as RelationshipIdentifiable).pipe(
|
||||||
take(1),
|
take(1),
|
||||||
@@ -165,12 +162,11 @@ export class ItemRelationshipsComponent extends AbstractItemUpdateComponent {
|
|||||||
map(() => relationshipRD)
|
map(() => relationshipRD)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return [relationshipRD];
|
return [relationshipRD];
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
} else {
|
} else {
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
}
|
}
|
||||||
@@ -228,7 +224,7 @@ export class ItemRelationshipsComponent extends AbstractItemUpdateComponent {
|
|||||||
}
|
}
|
||||||
return this.relationshipService.addRelationship(addRelationship.type.id, leftItem, rightItem, leftwardValue, rightwardValue, false);
|
return this.relationshipService.addRelationship(addRelationship.type.id, leftItem, rightItem, leftwardValue, rightwardValue, false);
|
||||||
}),
|
}),
|
||||||
)
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user