[ADF-3910] Expose the identityHost as part of the setting component (#4161)

This commit is contained in:
Maurizio Vitale
2019-01-16 13:01:15 +00:00
committed by Eugenio Romano
parent a49cd76fcb
commit 28da31c550
4 changed files with 56 additions and 0 deletions

View File

@@ -99,6 +99,7 @@ describe('HostSettingsComponent', () => {
beforeEach(() => {
appConfigService.config.providers = 'BPM';
appConfigService.config.authType = 'BASIC';
appConfigService.load();
fixture.detectChanges();
bpmUrlInput = element.querySelector('#bpmHost');
@@ -152,6 +153,7 @@ describe('HostSettingsComponent', () => {
beforeEach(() => {
appConfigService.config.providers = 'ECM';
appConfigService.config.authType = 'BASIC';
appConfigService.load();
fixture.detectChanges();
bpmUrlInput = element.querySelector('#bpmHost');
@@ -200,6 +202,7 @@ describe('HostSettingsComponent', () => {
beforeEach(() => {
appConfigService.config.providers = 'ALL';
appConfigService.config.authType = 'BASIC';
appConfigService.load();
fixture.detectChanges();
bpmUrlInput = element.querySelector('#bpmHost');
@@ -270,10 +273,12 @@ describe('HostSettingsComponent', () => {
let bpmUrlInput;
let ecmUrlInput;
let identityUrlInput;
let oauthHostUrlInput;
let clientIdInput;
beforeEach(() => {
appConfigService.config.identityHost = 'http://localhost:123';
appConfigService.config.providers = 'ALL';
appConfigService.config.authType = 'OAUTH';
appConfigService.config.oauth2 = {
@@ -289,6 +294,7 @@ describe('HostSettingsComponent', () => {
fixture.detectChanges();
bpmUrlInput = element.querySelector('#bpmHost');
ecmUrlInput = element.querySelector('#ecmHost');
identityUrlInput = element.querySelector('#identityHost');
oauthHostUrlInput = element.querySelector('#oauthHost');
clientIdInput = element.querySelector('#clientId');
});
@@ -300,6 +306,7 @@ describe('HostSettingsComponent', () => {
it('should have a valid form when the urls are correct', (done) => {
const urlBpm = 'http://localhost:9999/bpm';
const urlEcm = 'http://localhost:9999/bpm';
const urlIdentity = 'http://localhost:9999/identity';
component.form.statusChanges.subscribe((status: string) => {
expect(status).toEqual('VALID');
@@ -311,6 +318,9 @@ describe('HostSettingsComponent', () => {
bpmUrlInput.value = urlBpm;
bpmUrlInput.dispatchEvent(new Event('input'));
identityUrlInput.value = urlIdentity;
identityUrlInput.dispatchEvent(new Event('input'));
});
it('should have an invalid form when the url inserted is wrong', (done) => {
@@ -326,6 +336,19 @@ describe('HostSettingsComponent', () => {
bpmUrlInput.dispatchEvent(new Event('input'));
});
it('should have an invalid form when the identity url inserted is wrong', (done) => {
const url = 'wrong';
component.form.statusChanges.subscribe((status: string) => {
expect(status).toEqual('INVALID');
expect(component.identityHost.hasError('pattern')).toBeTruthy();
done();
});
identityUrlInput.value = url;
identityUrlInput.dispatchEvent(new Event('input'));
});
it('should have an invalid form when the host is wrong', (done) => {
const hostUrl = 'wrong';