Optimize tests and upgrade Nx workspace (#5884)

* fix issue with async await, use interface over class

* upgrade nx workspace

* remove useless async

* code fixes
This commit is contained in:
Denys Vuika
2020-07-16 22:34:50 +01:00
committed by GitHub
parent b9dc285d2b
commit b69fdb9370
17 changed files with 396 additions and 400 deletions

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { async, TestBed } from '@angular/core/testing';
import { TestBed } from '@angular/core/testing';
import { setupTestBed } from 'core';
import { CoreTestingModule } from 'core/testing/core.testing.module';
import { TranslateModule } from '@ngx-translate/core';
@@ -35,7 +35,7 @@ describe('ProcessNameCloudPipe', () => {
const nameWithProcessDefinitionIdentifier = `${defaultName} - ${processDefinitionIdentifier}`;
const nameWithDatetimeIdentifier = `${defaultName} - ${datetimeIdentifier}`;
const nameWithAllIdentifiers = `${defaultName} ${processDefinitionIdentifier} - ${datetimeIdentifier}`;
const fakeProcessInstanceDetails = new ProcessInstanceCloud({ processDefinitionName: 'my-process-definition' });
const fakeProcessInstanceDetails: ProcessInstanceCloud = { processDefinitionName: 'my-process-definition' };
setupTestBed({
imports: [
@@ -44,10 +44,10 @@ describe('ProcessNameCloudPipe', () => {
]
});
beforeEach(async(() => {
beforeEach(() => {
const localizedDatePipe = TestBed.inject(LocalizedDatePipe);
processNamePipe = new ProcessNameCloudPipe(localizedDatePipe);
}));
});
it('should not modify the name when there is no identifier', () => {
const transformResult = processNamePipe.transform(defaultName);

View File

@@ -19,9 +19,12 @@ import { Component, ViewChild } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { IdentityUserService, setupTestBed } from '@alfresco/adf-core';
import { CancelProcessDirective } from './cancel-process.directive';
import { processDetailsMockRunning, processDetailsMockCompleted } from '../mock/process-details.mock';
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
import { TranslateModule } from '@ngx-translate/core';
import { ProcessInstanceCloud } from '../start-process/models/process-instance-cloud.model';
const processDetailsMockRunning: ProcessInstanceCloud = { initiator: 'usermock', status: 'RUNNING' };
const processDetailsMockCompleted: ProcessInstanceCloud = { initiator: 'usermock', status: 'COMPLETED' };
describe('CancelProcessDirective', () => {

View File

@@ -29,11 +29,11 @@ export class CancelProcessDirective implements OnInit, OnDestroy {
/** Emitted when the process is cancelled. */
@Output()
success: EventEmitter<any> = new EventEmitter<any>();
success = new EventEmitter<any>();
/** Emitted when the process cannot be cancelled. */
@Output()
error: EventEmitter<any> = new EventEmitter<any>();
error = new EventEmitter<any>();
processInstanceDetails: ProcessInstanceCloud;
@@ -49,7 +49,7 @@ export class CancelProcessDirective implements OnInit, OnDestroy {
ngOnInit() {
this.processCloudService.dataChangesDetected
.pipe(takeUntil(this.onDestroy$))
.subscribe((processDetails: ProcessInstanceCloud) => {
.subscribe((processDetails) => {
this.processInstanceDetails = processDetails;
this.canCancelProcess = this.checkCanCancelProcess();
this.setElementVisibility();
@@ -57,12 +57,8 @@ export class CancelProcessDirective implements OnInit, OnDestroy {
}
@HostListener('click')
async onClick() {
try {
await this.cancelProcess();
} catch (error) {
this.error.emit(error);
}
onClick() {
this.cancelProcess();
}
private setElementVisibility() {
@@ -71,18 +67,16 @@ export class CancelProcessDirective implements OnInit, OnDestroy {
checkCanCancelProcess(): boolean {
const currentUser = this.identityUserService.getCurrentUserInfo().username;
return this.processInstanceDetails.initiator === currentUser && this.processInstanceDetails.status === 'RUNNING';
return this.processInstanceDetails.initiator === currentUser && this.processInstanceDetails.status === 'RUNNING';
}
async cancelProcess() {
cancelProcess() {
if (this.canCancelProcess) {
await this.processCloudService.cancelProcess(this.processInstanceDetails.appName, this.processInstanceDetails.id)
.pipe(takeUntil(this.onDestroy$))
.subscribe((response) => {
this.success.emit(response);
}, ((error) => {
this.error.emit(error);
}));
this.processCloudService.cancelProcess(this.processInstanceDetails.appName, this.processInstanceDetails.id)
.subscribe(
(response) => this.success.emit(response),
(error) => this.error.emit(error)
);
} else {
this.error.emit('Permission denied, only process initiator can cancel the process');
}

View File

@@ -1,22 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ProcessInstanceCloud } from '../start-process/models/process-instance-cloud.model';
export let processDetailsMockRunning = new ProcessInstanceCloud({ initiator: 'usermock', status: 'RUNNING' });
export let processDetailsMockCompleted = new ProcessInstanceCloud({ initiator: 'usermock', status: 'COMPLETED' });

View File

@@ -1,191 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ProcessFilterCloudModel } from '../models/process-filter-cloud.model';
export const fakeProcessCloudFilterEntries = {
list: {
entries: [
{
entry: {
key: 'process-filters-mock-appName-mock-username',
value: JSON.stringify([
{
name: 'MOCK_PROCESS_NAME_1',
id: '1',
key: 'all-mock-process',
icon: 'adjust',
appName: 'mock-appName',
sort: 'startDate',
status: 'MOCK_ALL',
order: 'DESC'
},
{
name: 'MOCK_PROCESS_NAME_2',
id: '2',
key: 'run-mock-process',
icon: 'adjust',
appName: 'mock-appName',
sort: 'startDate',
status: 'MOCK-RUNNING',
order: 'DESC'
},
{
name: 'MOCK_PROCESS_NAME_3',
id: '3',
key: 'complete-mock-process',
icon: 'adjust',
appName: 'mock-appName',
sort: 'startDate',
status: 'MOCK-COMPLETED',
order: 'DESC'
}
])
}
},
{
entry: {
key: 'mock-key-2',
value: {
name: 'MOCK_PROCESS_NAME_2',
id: '2',
key: 'run-mock-process',
icon: 'adjust',
appName: 'mock-appName',
sort: 'startDate',
status: 'MOCK-RUNNING',
order: 'DESC'
}
}
},
{
entry: {
key: 'mock-key-3',
value: {
name: 'MOCK_PROCESS_NAME_3',
id: '3',
key: 'complete-mock-process',
icon: 'adjust',
appName: 'mock-appName',
sort: 'startDate',
status: 'MOCK-COMPLETED',
order: 'DESC'
}
}
}
],
pagination: {
skipCount: 0,
maxItems: 100,
count: 3,
hasMoreItems: false,
totalItems: 3
}
}
};
export const fakeEmptyProcessCloudFilterEntries = {
list: {
entries: [],
pagination: {
skipCount: 0,
maxItems: 100,
count: 0,
hasMoreItems: false,
totalItems: 0
}
}
};
export const fakeProcessCloudFilterWithDifferentEntries = {
list: {
entries: [
{
entry: {
key: 'my-mock-key-1',
value: 'my-mock-value-2'
}
},
{
entry: {
key: 'my-mock-key-2',
value: 'my-mock-key-2'
}
}
],
pagination: {
skipCount: 0,
maxItems: 100,
count: 4,
hasMoreItems: false,
totalItems: 2
}
}
};
export const fakeProcessFilter: ProcessFilterCloudModel = {
name: 'MOCK_PROCESS_NAME_1',
id: '1',
key: 'all-mock-process',
icon: 'adjust',
appName: 'mock-appName',
sort: 'startDate',
status: 'MOCK_ALL',
order: 'DESC',
index: 2,
processName: 'process-name',
processInstanceId: 'processinstanceid',
initiator: 'mockuser',
processDefinitionId: 'processDefid',
processDefinitionKey: 'processDefKey',
lastModified: null,
lastModifiedTo: null,
lastModifiedFrom: null
};
export const fakeProcessCloudFilters = [
{
name: 'MOCK_PROCESS_NAME_1',
id: '1',
key: 'all-mock-process',
icon: 'adjust',
appName: 'mock-appName',
sort: 'startDate',
status: 'MOCK_ALL',
order: 'DESC'
},
{
name: 'MOCK_PROCESS_NAME_2',
id: '2',
key: 'run-mock-process',
icon: 'adjust',
appName: 'mock-appName',
sort: 'startDate',
status: 'MOCK-RUNNING',
order: 'DESC'
},
{
name: 'MOCK_PROCESS_NAME_3',
id: '3',
key: 'complete-mock-process',
icon: 'adjust',
appName: 'mock-appName',
sort: 'startDate',
status: 'MOCK-COMPLETED',
order: 'DESC'
}
];

View File

@@ -19,17 +19,11 @@ import { async, TestBed } from '@angular/core/testing';
import { setupTestBed, IdentityUserService } from '@alfresco/adf-core';
import { of } from 'rxjs';
import { ProcessFilterCloudService } from './process-filter-cloud.service';
import {
fakeProcessCloudFilterEntries,
fakeProcessCloudFilters,
fakeEmptyProcessCloudFilterEntries,
fakeProcessCloudFilterWithDifferentEntries,
fakeProcessFilter
} from '../mock/process-filters.cloud.mock';
import { PROCESS_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service';
import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service';
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
import { TranslateModule } from '@ngx-translate/core';
import { ProcessFilterCloudModel } from '../models/process-filter-cloud.model';
describe('ProcessFilterCloudService', () => {
let service: ProcessFilterCloudService;
@@ -39,7 +33,185 @@ describe('ProcessFilterCloudService', () => {
let createPreferenceSpy: jasmine.Spy;
let getCurrentUserInfoSpy: jasmine.Spy;
const identityUserMock = { username: 'mock-username', firstName: 'fake-identity-first-name', lastName: 'fake-identity-last-name', email: 'fakeIdentity@email.com' };
const identityUserMock = {
username: 'mock-username',
firstName: 'fake-identity-first-name',
lastName: 'fake-identity-last-name',
email: 'fakeIdentity@email.com'
};
const fakeProcessFilter: ProcessFilterCloudModel = {
name: 'MOCK_PROCESS_NAME_1',
id: '1',
key: 'all-mock-process',
icon: 'adjust',
appName: 'mock-appName',
sort: 'startDate',
status: 'MOCK_ALL',
order: 'DESC',
index: 2,
processName: 'process-name',
processInstanceId: 'processinstanceid',
initiator: 'mockuser',
processDefinitionId: 'processDefid',
processDefinitionKey: 'processDefKey',
lastModified: null,
lastModifiedTo: null,
lastModifiedFrom: null
};
const fakeProcessCloudFilterEntries = {
list: {
entries: [
{
entry: {
key: 'process-filters-mock-appName-mock-username',
value: JSON.stringify([
{
name: 'MOCK_PROCESS_NAME_1',
id: '1',
key: 'all-mock-process',
icon: 'adjust',
appName: 'mock-appName',
sort: 'startDate',
status: 'MOCK_ALL',
order: 'DESC'
},
{
name: 'MOCK_PROCESS_NAME_2',
id: '2',
key: 'run-mock-process',
icon: 'adjust',
appName: 'mock-appName',
sort: 'startDate',
status: 'MOCK-RUNNING',
order: 'DESC'
},
{
name: 'MOCK_PROCESS_NAME_3',
id: '3',
key: 'complete-mock-process',
icon: 'adjust',
appName: 'mock-appName',
sort: 'startDate',
status: 'MOCK-COMPLETED',
order: 'DESC'
}
])
}
},
{
entry: {
key: 'mock-key-2',
value: {
name: 'MOCK_PROCESS_NAME_2',
id: '2',
key: 'run-mock-process',
icon: 'adjust',
appName: 'mock-appName',
sort: 'startDate',
status: 'MOCK-RUNNING',
order: 'DESC'
}
}
},
{
entry: {
key: 'mock-key-3',
value: {
name: 'MOCK_PROCESS_NAME_3',
id: '3',
key: 'complete-mock-process',
icon: 'adjust',
appName: 'mock-appName',
sort: 'startDate',
status: 'MOCK-COMPLETED',
order: 'DESC'
}
}
}
],
pagination: {
skipCount: 0,
maxItems: 100,
count: 3,
hasMoreItems: false,
totalItems: 3
}
}
};
const fakeEmptyProcessCloudFilterEntries = {
list: {
entries: [],
pagination: {
skipCount: 0,
maxItems: 100,
count: 0,
hasMoreItems: false,
totalItems: 0
}
}
};
const fakeProcessCloudFilterWithDifferentEntries = {
list: {
entries: [
{
entry: {
key: 'my-mock-key-1',
value: 'my-mock-value-2'
}
},
{
entry: {
key: 'my-mock-key-2',
value: 'my-mock-key-2'
}
}
],
pagination: {
skipCount: 0,
maxItems: 100,
count: 4,
hasMoreItems: false,
totalItems: 2
}
}
};
const fakeProcessCloudFilters = [
{
name: 'MOCK_PROCESS_NAME_1',
id: '1',
key: 'all-mock-process',
icon: 'adjust',
appName: 'mock-appName',
sort: 'startDate',
status: 'MOCK_ALL',
order: 'DESC'
},
{
name: 'MOCK_PROCESS_NAME_2',
id: '2',
key: 'run-mock-process',
icon: 'adjust',
appName: 'mock-appName',
sort: 'startDate',
status: 'MOCK-RUNNING',
order: 'DESC'
},
{
name: 'MOCK_PROCESS_NAME_3',
id: '3',
key: 'complete-mock-process',
icon: 'adjust',
appName: 'mock-appName',
sort: 'startDate',
status: 'MOCK-COMPLETED',
order: 'DESC'
}
];
setupTestBed({
imports: [

View File

@@ -38,7 +38,7 @@ export class ProcessHeaderCloudComponent implements OnChanges, OnInit {
@Input()
processInstanceId: string;
processInstanceDetails: ProcessInstanceCloud = new ProcessInstanceCloud();
processInstanceDetails: ProcessInstanceCloud;
properties: CardViewItem[];
dateFormat: string;
dateLocale: string;
@@ -56,7 +56,7 @@ export class ProcessHeaderCloudComponent implements OnChanges, OnInit {
ngOnInit() {
this.processCloudService.dataChangesDetected
.pipe(takeUntil(this.onDestroy$))
.subscribe((processDetails: ProcessInstanceCloud) => {
.subscribe((processDetails) => {
this.processInstanceDetails = processDetails;
this.refreshData();
});
@@ -155,5 +155,4 @@ export class ProcessHeaderCloudComponent implements OnChanges, OnInit {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
}

View File

@@ -45,10 +45,10 @@ export class ProcessCloudService extends BaseCloudService {
if (appName && processInstanceId) {
const url = `${this.getBasePath(appName)}/query/v1/process-instances/${processInstanceId}`;
return this.get(url).pipe(
map((res: any) => {
return this.get<{ entry: ProcessInstanceCloud }>(url).pipe(
map((res) => {
this.dataChangesDetected.next(res.entry);
return new ProcessInstanceCloud(res.entry);
return res.entry;
})
);
} else {
@@ -69,7 +69,7 @@ export class ProcessCloudService extends BaseCloudService {
return this.delete(queryUrl).pipe(
map((res: any) => {
this.dataChangesDetected.next(res.entry);
return new ProcessInstanceCloud(res.entry);
return res.entry;
})
);
} else {

View File

@@ -377,7 +377,7 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
processDefinitionSelectionChanged(processDefinition: ProcessDefinitionCloud) {
if (processDefinition) {
const processInstanceDetails = new ProcessInstanceCloud({ processDefinitionName: processDefinition.name });
const processInstanceDetails: ProcessInstanceCloud = { processDefinitionName: processDefinition.name };
const defaultProcessName = this.processNameCloudPipe.transform(this.name, processInstanceDetails);
this.processInstanceName.setValue(defaultProcessName);
this.processInstanceName.markAsDirty();

View File

@@ -19,21 +19,19 @@ import { ProcessInstanceCloud } from '../models/process-instance-cloud.model';
import { ProcessPayloadCloud } from '../models/process-payload-cloud.model';
import { ProcessDefinitionCloud } from '../models/process-definition-cloud.model';
export let fakeProcessInstance = new ProcessInstanceCloud({
export const fakeProcessInstance: ProcessInstanceCloud = {
appName: 'simple-app',
appVersion: '',
id: 'd0b30377-dc5a-11e8-ae24-0a58646001fa',
name: 'My Process Name',
startDate: '2018-10-30T15:45:24.136+0000',
startDate: new Date('2018-10-30T15:45:24.136+0000'),
initiator: 'usermock',
status: 'RUNNING',
processDefinitionId: 'BasicProcess:1:d05062f1-c6fb-11e8-ae24-0a58646001fa',
processDefinitionKey: 'BasicProcess'
});
};
export let fakeCreatedProcessInstance = new ProcessInstanceCloud({
export const fakeCreatedProcessInstance: ProcessInstanceCloud = {
appName: 'simple-app',
appVersion: '',
id: 'd0b30377-dc5a-11e8-ae24-0a58646001fa',
name: 'My Process Name',
startDate: null,
@@ -41,9 +39,9 @@ export let fakeCreatedProcessInstance = new ProcessInstanceCloud({
status: 'CREATED',
processDefinitionId: 'BasicProcess:1:d05062f1-c6fb-11e8-ae24-0a58646001fa',
processDefinitionKey: 'BasicProcess'
});
};
export let fakeProcessDefinitions: ProcessDefinitionCloud[] = [
export const fakeProcessDefinitions: ProcessDefinitionCloud[] = [
new ProcessDefinitionCloud({
appName: 'myApp',
appVersion: 0,
@@ -100,7 +98,7 @@ export function fakeSingleProcessDefinitionWithoutForm(name: string): ProcessDef
];
}
export let fakeNoNameProcessDefinitions: ProcessDefinitionCloud[] = [
export const fakeNoNameProcessDefinitions: ProcessDefinitionCloud[] = [
new ProcessDefinitionCloud({
appName: 'myApp',
appVersion: 0,
@@ -117,13 +115,13 @@ export let fakeNoNameProcessDefinitions: ProcessDefinitionCloud[] = [
})
];
export let fakeProcessPayload = new ProcessPayloadCloud({
export const fakeProcessPayload = new ProcessPayloadCloud({
processDefinitionKey: 'NewProcess:1',
name: 'NewProcess 1',
payloadType: 'string'
});
export let fakeStartForm = {
export const fakeStartForm = {
'formRepresentation': {
'id': 'form-de8895be-d0d7-4434-beef-559b15305d72',
'name': 'StartEventForm',
@@ -187,7 +185,7 @@ export let fakeStartForm = {
}
};
export let fakeStartFormNotValid = {
export const fakeStartFormNotValid = {
'formRepresentation': {
'id': 'form-a5d50817-5183-4850-802d-17af54b2632f',
'name': 'simpleform',

View File

@@ -15,32 +15,17 @@
* limitations under the License.
*/
export class ProcessInstanceCloud {
appName: string;
id: string;
name: string;
startDate: Date;
initiator: string;
status: string;
businessKey: string;
lastModified: Date;
parentId: string;
processDefinitionId: string;
processDefinitionKey: string;
processDefinitionName: string;
constructor(obj?: any) {
this.appName = obj && obj.appName || null;
this.id = obj && obj.id || null;
this.name = obj && obj.name || null;
this.startDate = obj && obj.startDate || null;
this.initiator = obj && obj.initiator || null;
this.status = obj && obj.status || null;
this.businessKey = obj && obj.businessKey || null;
this.lastModified = obj && obj.lastModified || null;
this.parentId = obj && obj.parentId || null;
this.processDefinitionId = obj && obj.processDefinitionId || null;
this.processDefinitionKey = obj && obj.processDefinitionKey || null;
this.processDefinitionName = obj && obj.processDefinitionName || null;
}
export interface ProcessInstanceCloud {
appName?: string;
id?: string;
name?: string;
startDate?: Date;
initiator?: string;
status?: string;
businessKey?: string;
lastModified?: Date;
parentId?: string;
processDefinitionId?: string;
processDefinitionKey?: string;
processDefinitionName?: string;
}

View File

@@ -20,7 +20,6 @@ import { of, throwError } from 'rxjs';
import { setupTestBed, AlfrescoApiService } from '@alfresco/adf-core';
import { StartProcessCloudService } from './start-process-cloud.service';
import { fakeProcessPayload } from '../mock/start-process.component.mock';
import { ProcessInstanceCloud } from '../models/process-instance-cloud.model';
import { HttpErrorResponse, HttpClientModule } from '@angular/common/http';
import { ProcessDefinitionCloud } from '../models/process-definition-cloud.model';
@@ -39,7 +38,7 @@ describe('StartProcessCloudService', () => {
}
})
}
};
};
setupTestBed({
imports: [HttpClientModule]
@@ -54,7 +53,7 @@ describe('StartProcessCloudService', () => {
spyOn(service, 'startProcess').and.returnValue(of({ id: 'fake-id', name: 'fake-name' }));
service.startProcess('appName1', fakeProcessPayload)
.subscribe(
(res: ProcessInstanceCloud) => {
(res) => {
expect(res).toBeDefined();
expect(res.id).toEqual('fake-id');
expect(res.name).toEqual('fake-name');
@@ -119,7 +118,7 @@ describe('StartProcessCloudService', () => {
spyOn(service, 'createProcess').and.returnValue(of({ id: 'fake-id', name: 'fake-name', status: 'CREATED' }));
service.createProcess('appName1', fakeProcessPayload)
.subscribe(
(res: ProcessInstanceCloud) => {
(res) => {
expect(res).toBeDefined();
expect(res.id).toEqual('fake-id');
expect(res.name).toEqual('fake-name');
@@ -133,7 +132,7 @@ describe('StartProcessCloudService', () => {
spyOn(service, 'startCreatedProcess').and.returnValue(of({ id: 'fake-id', name: 'fake-name', status: 'RUNNING' }));
service.startCreatedProcess('appName1', 'fake-id', fakeProcessPayload)
.subscribe(
(res: ProcessInstanceCloud) => {
(res) => {
expect(res).toBeDefined();
expect(res.id).toEqual('fake-id');
expect(res.name).toEqual('fake-name');
@@ -147,7 +146,7 @@ describe('StartProcessCloudService', () => {
spyOn(alfrescoApiService, 'getInstance').and.returnValue(mock);
service.startCreatedProcess('appName1', 'fake-id', fakeProcessPayload)
.subscribe(
(res: ProcessInstanceCloud) => {
(res) => {
expect(res).toBeDefined();
expect(res.id).toEqual('fake-id');
expect(res.name).toEqual('fake-name');

View File

@@ -66,8 +66,7 @@ export class StartProcessCloudService extends BaseCloudService {
payload.payloadType = 'CreateProcessInstancePayload';
return this.post(url, payload).pipe(
map((result: any) => result.entry),
map(processInstance => new ProcessInstanceCloud(processInstance))
map((result: any) => result.entry)
);
}
@@ -80,8 +79,7 @@ export class StartProcessCloudService extends BaseCloudService {
const url = `${this.getBasePath(appName)}/rb/v1/process-instances/${createdProcessInstanceId}/start`;
return this.post(url, payload).pipe(
map((result: any) => result.entry),
map(processInstance => new ProcessInstanceCloud(processInstance))
map((result: any) => result.entry)
);
}
@@ -95,9 +93,7 @@ export class StartProcessCloudService extends BaseCloudService {
const url = `${this.getBasePath(appName)}/rb/v1/process-instances`;
payload.payloadType = 'StartProcessPayload';
return this.post(url, payload).pipe(
map(processInstance => new ProcessInstanceCloud(processInstance))
);
return this.post(url, payload);
}
/**
@@ -112,9 +108,7 @@ export class StartProcessCloudService extends BaseCloudService {
payload.payloadType = 'UpdateProcessPayload';
return this.put(url, payload).pipe(
map((processInstance: any) => {
return new ProcessInstanceCloud(processInstance.entry);
})
map((processInstance: any) => processInstance.entry)
);
}