mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
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:
parent
f02272ac68
commit
3df6bcea26
@ -28,19 +28,6 @@ describe('StartProcessCloudService', () => {
|
|||||||
let service: StartProcessCloudService;
|
let service: StartProcessCloudService;
|
||||||
let alfrescoApiService: AlfrescoApiService;
|
let alfrescoApiService: AlfrescoApiService;
|
||||||
|
|
||||||
const mock: any = {
|
|
||||||
oauth2Auth: {
|
|
||||||
callCustomApi: () => Promise.resolve({
|
|
||||||
entry: {
|
|
||||||
id: 'fake-id',
|
|
||||||
name: 'fake-name',
|
|
||||||
status: 'RUNNING'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
isEcmLoggedIn: () => false
|
|
||||||
};
|
|
||||||
|
|
||||||
setupTestBed({
|
setupTestBed({
|
||||||
imports: [HttpClientModule]
|
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) => {
|
it('should transform the response into task variables', (done) => {
|
||||||
const appName = 'test-app';
|
const appName = 'test-app';
|
||||||
const processDefinitionId = 'processDefinitionId';
|
const processDefinitionId = 'processDefinitionId';
|
||||||
|
@ -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.
|
* Starts a process based on a process definition, name, form values or variables.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user