[ACA-2948] Add API to fetch the bpm properties (#5610)

* Add the api to fetch the bpm properties

* remove useless map

* Use latest api

* Use the BehaviorSubject

* filter the status true
This commit is contained in:
Maurizio Vitale
2020-04-16 17:23:00 +01:00
committed by GitHub
parent 55a5cc073b
commit e56331fecb
7 changed files with 112 additions and 41 deletions

View File

@@ -21,6 +21,7 @@ import { AppConfigService } from '../app-config/app-config.service';
import { DiscoveryApiService } from './discovery-api.service';
import { setupTestBed } from '../testing/setup-test-bed';
import { CoreTestingModule } from '../testing/core.testing.module';
import { SystemPropertiesRepresentation } from '@alfresco/js-api';
declare let jasmine: any;
@@ -87,6 +88,18 @@ const fakeBPMDiscoveryResponse: any = {
'minorVersion': '6'
};
const fakeBPMDiscoverySystemPropertyResponse: any = {
'allowInvolveByEmail': true,
'disableJavaScriptEventsInFormEditor': false,
'logoutDisabled': false,
'authConfiguration': {
'authUrl': 'fakeAuthUrl',
'realm': 'fakeRealm',
'clientId': 'fakeClient',
'useBrowserLogout': true
}
};
describe('Discovery Api Service', () => {
let service;
@@ -172,5 +185,42 @@ describe('Discovery Api Service', () => {
status: 403
});
});
it('Should retrieve the system properties for BPM', (done) => {
service.getBPMSystemProperties().subscribe((data: SystemPropertiesRepresentation) => {
expect(data).not.toBeNull();
expect(data.allowInvolveByEmail).toBe(true);
expect(data.disableJavaScriptEventsInFormEditor).toBe(false);
expect(data.logoutDisabled).toBe(false);
expect(data.authConfiguration.authUrl).toBe('fakeAuthUrl');
expect(data.authConfiguration.realm).toBe('fakeRealm');
expect(data.authConfiguration.clientId).toBe('fakeClient');
expect(data.authConfiguration.useBrowserLogout).toBe(true);
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: fakeBPMDiscoverySystemPropertyResponse
});
});
it('Should retrieve the system properties for BPM', (done) => {
service.getBPMSystemProperties().subscribe(
() => {
fail('expected an error, bpm not running');
},
(error) => {
expect(error.response.statusCode).toEqual(404);
expect(error.response.statusText).toEqual('Not Found');
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({
status: 404,
statusText: 'Not Found'
});
});
});
});