[ADF-1162] Form List - Fix the getForms service response (#2125)

* Fix the getForms service response

* Fix unit test
This commit is contained in:
Maurizio Vitale 2017-07-25 14:08:42 +01:00 committed by Eugenio Romano
parent 92e30c2fa3
commit df32a49c9e
2 changed files with 10 additions and 5 deletions

View File

@ -355,14 +355,19 @@ describe('Form service', () => {
it('should get all the forms with modelType=2', (done) => {
service.getForms().subscribe(result => {
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('models?modelType=2')).toBeTruthy();
expect(result).toEqual({});
expect(result.length).toEqual(2);
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({
'status': 200,
contentType: 'application/json',
responseText: JSON.stringify({})
responseText: JSON.stringify({
data: [
{ name: 'FakeName-1', lastUpdatedByFullName: 'FakeUser-1', lastUpdated: '2017-01-02' },
{ name: 'FakeName-2', lastUpdatedByFullName: 'FakeUser-2', lastUpdated: '2017-01-03' }
]
})
});
});

View File

@ -150,9 +150,9 @@ export class FormService {
'modelType': 2
};
return Observable.fromPromise(
this.apiService.getInstance().activiti.modelsApi.getModels(opts)
);
return Observable.fromPromise(this.apiService.getInstance().activiti.modelsApi.getModels(opts))
.map(this.toJsonArray)
.catch(err => this.handleError(err));
}
/**