mime.js 1.1 KB

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