mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
62589: Post-Merge Tests and error fixes
This commit is contained in:
@@ -72,7 +72,7 @@ describe('CollectionItemMapperComponent', () => {
|
||||
paginatedSearchOptions: mockSearchOptions
|
||||
};
|
||||
const itemDataServiceStub = {
|
||||
mapToCollection: () => of(new RestResponse(true, '200'))
|
||||
mapToCollection: () => of(new RestResponse(true, 200, 'OK'))
|
||||
};
|
||||
const activatedRouteStub = new ActivatedRouteStub({}, { collection: mockCollectionRD });
|
||||
const translateServiceStub = {
|
||||
@@ -134,11 +134,6 @@ describe('CollectionItemMapperComponent', () => {
|
||||
describe('mapItems', () => {
|
||||
const ids = ['id1', 'id2', 'id3', 'id4'];
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(notificationsService, 'success').and.callThrough();
|
||||
spyOn(notificationsService, 'error').and.callThrough();
|
||||
});
|
||||
|
||||
it('should display a success message if at least one mapping was successful', () => {
|
||||
comp.mapItems(ids);
|
||||
expect(notificationsService.success).toHaveBeenCalled();
|
||||
@@ -146,7 +141,7 @@ describe('CollectionItemMapperComponent', () => {
|
||||
});
|
||||
|
||||
it('should display an error message if at least one mapping was unsuccessful', () => {
|
||||
spyOn(itemDataService, 'mapToCollection').and.returnValue(of(new RestResponse(false, '404')));
|
||||
spyOn(itemDataService, 'mapToCollection').and.returnValue(of(new RestResponse(false, 404, 'Not Found')));
|
||||
comp.mapItems(ids);
|
||||
expect(notificationsService.success).not.toHaveBeenCalled();
|
||||
expect(notificationsService.error).toHaveBeenCalled();
|
||||
|
@@ -69,8 +69,8 @@ describe('ItemCollectionMapperComponent', () => {
|
||||
};
|
||||
const mockCollectionsRD = new RemoteData(false, false, true, null, new PaginatedList(new PageInfo(), []));
|
||||
const itemDataServiceStub = {
|
||||
mapToCollection: () => of(new RestResponse(true, '200')),
|
||||
removeMappingFromCollection: () => of(new RestResponse(true, '200')),
|
||||
mapToCollection: () => of(new RestResponse(true, 200, 'OK')),
|
||||
removeMappingFromCollection: () => of(new RestResponse(true, 200, 'OK')),
|
||||
getMappedCollections: () => of(mockCollectionsRD),
|
||||
/* tslint:disable:no-empty */
|
||||
clearMappedCollectionsRequests: () => {}
|
||||
@@ -128,11 +128,6 @@ describe('ItemCollectionMapperComponent', () => {
|
||||
describe('mapCollections', () => {
|
||||
const ids = ['id1', 'id2', 'id3', 'id4'];
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(notificationsService, 'success').and.callThrough();
|
||||
spyOn(notificationsService, 'error').and.callThrough();
|
||||
});
|
||||
|
||||
it('should display a success message if at least one mapping was successful', () => {
|
||||
comp.mapCollections(ids);
|
||||
expect(notificationsService.success).toHaveBeenCalled();
|
||||
@@ -140,7 +135,7 @@ describe('ItemCollectionMapperComponent', () => {
|
||||
});
|
||||
|
||||
it('should display an error message if at least one mapping was unsuccessful', () => {
|
||||
spyOn(itemDataService, 'mapToCollection').and.returnValue(of(new RestResponse(false, '404')));
|
||||
spyOn(itemDataService, 'mapToCollection').and.returnValue(of(new RestResponse(false, 404, 'Not Found')));
|
||||
comp.mapCollections(ids);
|
||||
expect(notificationsService.success).not.toHaveBeenCalled();
|
||||
expect(notificationsService.error).toHaveBeenCalled();
|
||||
@@ -150,11 +145,6 @@ describe('ItemCollectionMapperComponent', () => {
|
||||
describe('removeMappings', () => {
|
||||
const ids = ['id1', 'id2', 'id3', 'id4'];
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(notificationsService, 'success').and.callThrough();
|
||||
spyOn(notificationsService, 'error').and.callThrough();
|
||||
});
|
||||
|
||||
it('should display a success message if the removal of at least one mapping was successful', () => {
|
||||
comp.removeMappings(ids);
|
||||
expect(notificationsService.success).toHaveBeenCalled();
|
||||
@@ -162,7 +152,7 @@ describe('ItemCollectionMapperComponent', () => {
|
||||
});
|
||||
|
||||
it('should display an error message if the removal of at least one mapping was unsuccessful', () => {
|
||||
spyOn(itemDataService, 'removeMappingFromCollection').and.returnValue(of(new RestResponse(false, '404')));
|
||||
spyOn(itemDataService, 'removeMappingFromCollection').and.returnValue(of(new RestResponse(false, 404, 'Not Found')));
|
||||
comp.removeMappings(ids);
|
||||
expect(notificationsService.success).not.toHaveBeenCalled();
|
||||
expect(notificationsService.error).toHaveBeenCalled();
|
||||
|
@@ -20,8 +20,8 @@
|
||||
<tr *ngFor="let item of itemsRD?.payload?.page">
|
||||
<td><input class="item-checkbox" [ngModel]="getSelected(item.id) | async" (change)="switch(item.id)" type="checkbox" name="{{item.id}}"></td>
|
||||
<td *ngIf="!hideCollection"><a [routerLink]="['/items', item.id]">{{(item.owningCollection | async)?.payload?.name}}</a></td>
|
||||
<td><a *ngIf="item.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length > 0" [routerLink]="['/items', item.id]">{{item.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*'])[0].value}}</a></td>
|
||||
<td><a [routerLink]="['/items', item.id]">{{item.findMetadata("dc.title")}}</a></td>
|
||||
<td><a *ngIf="item.hasMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*'])" [routerLink]="['/items', item.id]">{{item.firstMetadataValue(['dc.contributor.author', 'dc.creator', 'dc.contributor.*'])}}</a></td>
|
||||
<td><a [routerLink]="['/items', item.id]">{{item.firstMetadataValue("dc.title")}}</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
Reference in New Issue
Block a user