[ADF-2306] DocumentList should let configure the includeFields request to the se… (#3109)

* DocumentList should let configure the includeFields request to the server

* fix test

* fix test after rebase

* fix permissions

* travis_wait dist
This commit is contained in:
Eugenio Romano
2018-03-22 09:27:12 +00:00
committed by GitHub
parent 99e694ef98
commit e8e2af7d6b
9 changed files with 136 additions and 41 deletions

View File

@@ -28,6 +28,7 @@ declare let jasmine: any;
describe('DocumentListService', () => {
let service: DocumentListService;
let alfrescoApiService: AlfrescoApiService;
let fakeEntryNode = {
'entry': {
@@ -35,9 +36,9 @@ describe('DocumentListService', () => {
'createdAt': '2016-12-06T15:58:32.408+0000',
'isFolder': true,
'isFile': false,
'createdByUser': {'id': 'admin', 'displayName': 'Administrator'},
'createdByUser': { 'id': 'admin', 'displayName': 'Administrator' },
'modifiedAt': '2016-12-06T15:58:32.408+0000',
'modifiedByUser': {'id': 'admin', 'displayName': 'Administrator'},
'modifiedByUser': { 'id': 'admin', 'displayName': 'Administrator' },
'name': 'fake-name',
'id': '2214733d-a920-4dbe-af95-4230345fae82',
'nodeType': 'cm:folder',
@@ -58,7 +59,7 @@ describe('DocumentListService', () => {
let fakeFolder = {
'list': {
'pagination': {'count': 1, 'hasMoreItems': false, 'totalItems': 1, 'skipCount': 0, 'maxItems': 20},
'pagination': { 'count': 1, 'hasMoreItems': false, 'totalItems': 1, 'skipCount': 0, 'maxItems': 20 },
'entries': [{
'entry': {
'createdAt': '2016-12-06T13:03:14.880+0000',
@@ -68,19 +69,19 @@ describe('DocumentListService', () => {
'elements': [{
'id': 'ed7ab80e-b398-4bed-b38d-139ae4cc592a',
'name': 'Company Home'
}, {'id': '99e1368f-e816-47fc-a8bf-3b358feaf31e', 'name': 'Sites'}, {
}, { 'id': '99e1368f-e816-47fc-a8bf-3b358feaf31e', 'name': 'Sites' }, {
'id': 'b4cff62a-664d-4d45-9302-98723eac1319',
'name': 'swsdp'
}, {
'id': '8f2105b4-daaf-4874-9e8a-2152569d109b',
'name': 'documentLibrary'
}, {'id': '17fa78d2-4d6b-4a46-876b-4b0ea07f7f32', 'name': 'empty'}]
}, { 'id': '17fa78d2-4d6b-4a46-876b-4b0ea07f7f32', 'name': 'empty' }]
},
'isFolder': true,
'isFile': false,
'createdByUser': {'id': 'admin', 'displayName': 'Administrator'},
'createdByUser': { 'id': 'admin', 'displayName': 'Administrator' },
'modifiedAt': '2016-12-06T13:03:14.880+0000',
'modifiedByUser': {'id': 'admin', 'displayName': 'Administrator'},
'modifiedByUser': { 'id': 'admin', 'displayName': 'Administrator' },
'name': 'fake-name',
'id': 'aac546f6-1525-46ff-bf6b-51cb85f3cda7',
'nodeType': 'cm:folder',
@@ -92,7 +93,7 @@ describe('DocumentListService', () => {
beforeEach(() => {
let contentService = new ContentService(null, null, null, null);
let alfrescoApiService = new AlfrescoApiService(new AppConfigService(null), new StorageService());
alfrescoApiService = new AlfrescoApiService(new AppConfigService(null), new StorageService());
service = new DocumentListService(null, contentService, alfrescoApiService, null, null);
jasmine.Ajax.install();
});
@@ -157,6 +158,53 @@ describe('DocumentListService', () => {
});
});
it('should add the includeTypes in the request Node Children if required', () => {
let spyGetNodeInfo = spyOn(alfrescoApiService.getInstance().nodes, 'getNodeChildren');
service.getFolder('/fake-root/fake-name', {}, ['isLocked']);
expect(spyGetNodeInfo).toHaveBeenCalledWith('-root-', {
includeSource: true,
include: ['path', 'properties', 'allowableOperations', 'permissions', 'isLocked'],
relativePath: '/fake-root/fake-name'
});
});
it('should not add the includeTypes in the request Node Children if is duplicated', () => {
let spyGetNodeInfo = spyOn(alfrescoApiService.getInstance().nodes, 'getNodeChildren');
service.getFolder('/fake-root/fake-name', {}, ['allowableOperations']);
expect(spyGetNodeInfo).toHaveBeenCalledWith('-root-', {
includeSource: true,
include: ['path', 'properties', 'allowableOperations', 'permissions'],
relativePath: '/fake-root/fake-name'
});
});
it('should add the includeTypes in the request getFolderNode if required', () => {
let spyGetNodeInfo = spyOn(alfrescoApiService.getInstance().nodes, 'getNodeInfo');
service.getFolderNode('test-id', ['isLocked']);
expect(spyGetNodeInfo).toHaveBeenCalledWith('test-id', {
includeSource: true,
include: ['path', 'properties', 'allowableOperations', 'permissions', 'isLocked']
});
});
it('should not add the includeTypes in the request getFolderNode if is duplicated', () => {
let spyGetNodeInfo = spyOn(alfrescoApiService.getInstance().nodes, 'getNodeInfo');
service.getFolderNode('test-id', ['allowableOperations']);
expect(spyGetNodeInfo).toHaveBeenCalledWith('test-id', {
includeSource: true,
include: ['path', 'properties', 'allowableOperations', 'permissions']
}
);
});
it('should delete the folder', () => {
service.deleteNode('fake-id').subscribe(
res => {
@@ -189,4 +237,4 @@ describe('DocumentListService', () => {
jasmine.Ajax.requests.mostRecent().respondWith({ status: 200, contentType: 'json' });
});
});
})