AAE-12063 removed startCreatedProcess with relevant unit tests (#8131)

* AAE-12063 removed startCreatedProcess with relevant unit tests

* AAE-12063 removed createProcess with relevant unit tests
This commit is contained in:
tomasz hanaj 2023-01-24 18:26:04 +01:00 committed by GitHub
parent f02272ac68
commit 3df6bcea26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 85 deletions

View File

@ -28,19 +28,6 @@ describe('StartProcessCloudService', () => {
let service: StartProcessCloudService;
let alfrescoApiService: AlfrescoApiService;
const mock: any = {
oauth2Auth: {
callCustomApi: () => Promise.resolve({
entry: {
id: 'fake-id',
name: 'fake-name',
status: 'RUNNING'
}
})
},
isEcmLoggedIn: () => false
};
setupTestBed({
imports: [HttpClientModule]
});
@ -115,48 +102,6 @@ describe('StartProcessCloudService', () => {
);
});
it('should be able to create a new process instance without starting it', (done) => {
spyOn(service, 'createProcess').and.returnValue(of({ id: 'fake-id', name: 'fake-name', status: 'CREATED' }));
service.createProcess('appName1', fakeProcessPayload)
.subscribe(
(res) => {
expect(res).toBeDefined();
expect(res.id).toEqual('fake-id');
expect(res.name).toEqual('fake-name');
expect(res.status).toEqual('CREATED');
done();
}
);
});
it('should be able to start a created new process instance', (done) => {
spyOn(service, 'startCreatedProcess').and.returnValue(of({ id: 'fake-id', name: 'fake-name', status: 'RUNNING' }));
service.startCreatedProcess('appName1', 'fake-id', fakeProcessPayload)
.subscribe(
(res) => {
expect(res).toBeDefined();
expect(res.id).toEqual('fake-id');
expect(res.name).toEqual('fake-name');
expect(res.status).toEqual('RUNNING');
done();
}
);
});
it('should map the response when create a new process instance', (done) => {
spyOn(alfrescoApiService, 'getInstance').and.returnValue(mock);
service.startCreatedProcess('appName1', 'fake-id', fakeProcessPayload)
.subscribe(
(res) => {
expect(res).toBeDefined();
expect(res.id).toEqual('fake-id');
expect(res.name).toEqual('fake-name');
expect(res.status).toEqual('RUNNING');
done();
}
);
});
it('should transform the response into task variables', (done) => {
const appName = 'test-app';
const processDefinitionId = 'processDefinitionId';

View File

@ -55,36 +55,6 @@ export class StartProcessCloudService extends BaseCloudService {
}
}
/**
* Create a process based on a process definition, name, form values or variables.
*
* @param appName name of the Application
* @param payload Details of the process (definition key, name, variables, etc)
* @returns Details of the process instance just created
*/
createProcess(appName: string, payload: ProcessPayloadCloud): Observable<ProcessInstanceCloud> {
const url = `${this.getBasePath(appName)}/rb/v1/process-instances/create`;
payload.payloadType = 'CreateProcessInstancePayload';
return this.post(url, payload).pipe(
map((result: any) => result.entry)
);
}
/**
* Starts an already created process using the process instance id.
*
* @param createdProcessInstanceId process instance id of the process previously created
* @returns Details of the process instance just started
*/
startCreatedProcess(appName: string, createdProcessInstanceId: string, payload: ProcessPayloadCloud): Observable<ProcessInstanceCloud> {
const url = `${this.getBasePath(appName)}/rb/v1/process-instances/${createdProcessInstanceId}/start`;
return this.post(url, payload).pipe(
map((result: any) => result.entry)
);
}
/**
* Starts a process based on a process definition, name, form values or variables.
*