mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
fix issue where curation tasks wouldn't work for collections and communities because the handle was in the wrong format
This commit is contained in:
@@ -15,6 +15,7 @@ import { By } from '@angular/platform-browser';
|
||||
import { ConfigurationDataService } from '../core/data/configuration-data.service';
|
||||
import { ConfigurationProperty } from '../core/shared/configuration-property.model';
|
||||
import { getProcessDetailRoute } from '../process-page/process-page-routing.paths';
|
||||
import { HandleService } from '../shared/handle.service';
|
||||
|
||||
describe('CurationFormComponent', () => {
|
||||
let comp: CurationFormComponent;
|
||||
@@ -23,6 +24,7 @@ describe('CurationFormComponent', () => {
|
||||
let scriptDataService: ScriptDataService;
|
||||
let processDataService: ProcessDataService;
|
||||
let configurationDataService: ConfigurationDataService;
|
||||
let handleService: HandleService;
|
||||
let notificationsService;
|
||||
let router;
|
||||
|
||||
@@ -51,6 +53,10 @@ describe('CurationFormComponent', () => {
|
||||
}))
|
||||
});
|
||||
|
||||
handleService = {
|
||||
normalizeHandle: (a) => a
|
||||
} as any;
|
||||
|
||||
notificationsService = new NotificationsServiceStub();
|
||||
router = new RouterStub();
|
||||
|
||||
@@ -58,11 +64,12 @@ describe('CurationFormComponent', () => {
|
||||
imports: [TranslateModule.forRoot(), FormsModule, ReactiveFormsModule],
|
||||
declarations: [CurationFormComponent],
|
||||
providers: [
|
||||
{provide: ScriptDataService, useValue: scriptDataService},
|
||||
{provide: ProcessDataService, useValue: processDataService},
|
||||
{provide: NotificationsService, useValue: notificationsService},
|
||||
{provide: Router, useValue: router},
|
||||
{provide: ConfigurationDataService, useValue: configurationDataService},
|
||||
{ provide: ScriptDataService, useValue: scriptDataService },
|
||||
{ provide: ProcessDataService, useValue: processDataService },
|
||||
{ provide: NotificationsService, useValue: notificationsService },
|
||||
{ provide: HandleService, useValue: handleService },
|
||||
{ provide: Router, useValue: router},
|
||||
{ provide: ConfigurationDataService, useValue: configurationDataService },
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
}).compileComponents();
|
||||
@@ -143,4 +150,13 @@ describe('CurationFormComponent', () => {
|
||||
{name: '-i', value: 'all'},
|
||||
], []);
|
||||
});
|
||||
|
||||
it(`should show an error notification and return when an invalid dsoHandle is provided`, () => {
|
||||
comp.dsoHandle = 'test-handle';
|
||||
spyOn(handleService, 'normalizeHandle').and.returnValue(null);
|
||||
comp.submit();
|
||||
|
||||
expect(notificationsService.error).toHaveBeenCalled();
|
||||
expect(scriptDataService.invoke).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user