107671: Fix handle theme not working with canonical prefix https://hdl.handle.net/

(cherry picked from commit a7faf7d449)
This commit is contained in:
Alexandre Vryghem
2023-10-16 22:16:22 +02:00
committed by github-actions[bot]
parent 626cc30738
commit d3fdfebde1
10 changed files with 347 additions and 165 deletions

View File

@@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed, waitForAsync, fakeAsync, flush } from '@angular/core/testing';
import { TranslateModule } from '@ngx-translate/core';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CurationFormComponent } from './curation-form.component';
@@ -16,6 +16,7 @@ import { ConfigurationDataService } from '../core/data/configuration-data.servic
import { ConfigurationProperty } from '../core/shared/configuration-property.model';
import { getProcessDetailRoute } from '../process-page/process-page-routing.paths';
import { HandleService } from '../shared/handle.service';
import { of as observableOf } from 'rxjs';
describe('CurationFormComponent', () => {
let comp: CurationFormComponent;
@@ -54,7 +55,7 @@ describe('CurationFormComponent', () => {
});
handleService = {
normalizeHandle: (a) => a
normalizeHandle: (a: string) => observableOf(a),
} as any;
notificationsService = new NotificationsServiceStub();
@@ -151,12 +152,13 @@ describe('CurationFormComponent', () => {
], []);
});
it(`should show an error notification and return when an invalid dsoHandle is provided`, () => {
it(`should show an error notification and return when an invalid dsoHandle is provided`, fakeAsync(() => {
comp.dsoHandle = 'test-handle';
spyOn(handleService, 'normalizeHandle').and.returnValue(null);
spyOn(handleService, 'normalizeHandle').and.returnValue(observableOf(null));
comp.submit();
flush();
expect(notificationsService.error).toHaveBeenCalled();
expect(scriptDataService.invoke).not.toHaveBeenCalled();
});
}));
});