mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
@@ -15,16 +15,29 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { describe, beforeEach, beforeEachProviders, inject } from '@angular/core/testing';
|
||||||
import { AlfrescoThumbnailService } from './alfresco-thumbnail.service';
|
import { AlfrescoThumbnailService } from './alfresco-thumbnail.service';
|
||||||
|
import { AlfrescoApiService, AlfrescoAuthenticationService, AlfrescoContentService, AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
describe('AlfrescoThumbnailService', () => {
|
describe('AlfrescoThumbnailService', () => {
|
||||||
|
|
||||||
let service: AlfrescoThumbnailService;
|
let service: AlfrescoThumbnailService;
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
service = new AlfrescoThumbnailService(null);
|
beforeEachProviders(() => {
|
||||||
|
return [
|
||||||
|
AlfrescoApiService,
|
||||||
|
AlfrescoAuthenticationService,
|
||||||
|
AlfrescoContentService,
|
||||||
|
AlfrescoSettingsService,
|
||||||
|
AlfrescoThumbnailService
|
||||||
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
beforeEach(inject([AlfrescoThumbnailService], (thumbnailService: AlfrescoThumbnailService) => {
|
||||||
|
service = thumbnailService;
|
||||||
|
}));
|
||||||
|
|
||||||
it('should return the correct icon for a plain text file', () => {
|
it('should return the correct icon for a plain text file', () => {
|
||||||
expect(service.getMimeTypeIcon('text/plain')).toBe('ft_ic_document.svg');
|
expect(service.getMimeTypeIcon('text/plain')).toBe('ft_ic_document.svg');
|
||||||
});
|
});
|
||||||
@@ -41,4 +54,9 @@ describe('AlfrescoThumbnailService', () => {
|
|||||||
expect(service.getMimeTypeIcon('x-unknown/yyy')).toBe('ft_ic_miscellaneous.svg');
|
expect(service.getMimeTypeIcon('x-unknown/yyy')).toBe('ft_ic_miscellaneous.svg');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return the thumbnail URL for a content item', () => {
|
||||||
|
spyOn(service.contentService, 'getDocumentThumbnailUrl').and.returnValue('/fake-thumbnail.png');
|
||||||
|
expect(service.getDocumentThumbnailUrl({})).toBe('/fake-thumbnail.png');
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export class AlfrescoThumbnailService {
|
|||||||
'application/vnd.apple.numbers': 'ft_ic_spreadsheet'
|
'application/vnd.apple.numbers': 'ft_ic_spreadsheet'
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(private contentService: AlfrescoContentService) {
|
constructor(public contentService: AlfrescoContentService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user