mime.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. describe('MimeService', function() {
  2. let $service;
  3. // Ignoring page reload request
  4. beforeAll(() => window.onbeforeunload = () => null);
  5. beforeEach(function() {
  6. module('pascalprecht.translate');
  7. module('3ema.services');
  8. // Inject the service
  9. inject(function(MimeService) {
  10. $service = MimeService;
  11. });
  12. });
  13. it('getLabel', () => {
  14. expect($service.getLabel('application/pdf')).toEqual('mimeTypes.pdf');
  15. expect($service.getLabel('application/vnd.android.package-archive')).toEqual('mimeTypes.apk');
  16. expect($service.getLabel('audio/mpeg3')).toEqual('mimeTypes.audio');
  17. expect($service.getLabel('audio/x-mpeg-3')).toEqual('mimeTypes.audio');
  18. expect($service.getLabel('audio/foobar')).toEqual('mimeTypes.audio');
  19. });
  20. it('getIcon', () => {
  21. expect($service.getIconUrl('application/pdf')).toEqual('img/mime/ic_doc_pdf.png');
  22. expect($service.getIconUrl('application/vnd.android.package-archive')).toEqual('img/mime/ic_doc_apk.png');
  23. expect($service.getIconUrl('video/baz')).toEqual('img/mime/ic_doc_video.png');
  24. });
  25. });