[ADF-4647] download service (#4836)

* split download api into separate service

* move tests and fix code

* break dependency for thumbnail service

* update tests

* test fixes

* fix code

* fix unit tests
This commit is contained in:
Denys Vuika
2019-07-12 13:58:47 +01:00
committed by Eugenio Romano
parent d0d1154f84
commit a37f935c05
14 changed files with 231 additions and 103 deletions

View File

@@ -79,7 +79,7 @@ describe('ContentService', () => {
it('should return a valid content URL', (done) => {
authService.login('fake-username', 'fake-password').subscribe(() => {
expect(contentService.getContentUrl(node)).toBe('http://localhost:9876/ecm/alfresco/api/' +
expect(contentService.getContentUrl(node)).toContain('/ecm/alfresco/api/' +
'-default-/public/alfresco/versions/1/nodes/fake-node-id/content?attachment=false&alf_ticket=fake-post-ticket');
done();
});
@@ -94,7 +94,7 @@ describe('ContentService', () => {
it('should return a valid thumbnail URL', (done) => {
authService.login('fake-username', 'fake-password').subscribe(() => {
expect(contentService.getDocumentThumbnailUrl(node))
.toBe('http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco' +
.toContain('/ecm/alfresco/api/-default-/public/alfresco' +
'/versions/1/nodes/fake-node-id/renditions/doclib/content?attachment=false&alf_ticket=fake-post-ticket');
done();
});
@@ -178,19 +178,4 @@ describe('ContentService', () => {
expect(contentService.hasPermissions(permissionNode, '!Consumer')).toBeFalsy();
});
});
describe('Download blob', () => {
it('Should use native msSaveOrOpenBlob if the browser is IE', (done) => {
const navigatorAny: any = window.navigator;
navigatorAny.__defineGetter__('msSaveOrOpenBlob', () => {
done();
});
const blob = new Blob([''], { type: 'text/html' });
contentService.downloadBlob(blob, 'test_ie');
});
});
});