mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[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:
@@ -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'
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user