All files / src/AttachmentViewer Attachment.js

66.66% Statements 6/9
75% Branches 3/4
66.66% Functions 2/3
66.66% Lines 6/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 372x 2x                                   10x 10x       10x 10x                      
const UNASSIGNED = 'Unassigned';
const BROWSER_SUPPORTED_FILES = [
  'pdf',
  'text',
  'txt',
  'css',
  'jpg',
  'jpeg',
  'gif',
  'png',
  'bmp',
  'ico',
  'sh',
  'mp3',
  'wav',
  'ogg'
];
 
export function isAudioFile(fileName) {
  const extension = getExtensionFromFileName(fileName);
  return /mp3|wav|ogg/i.test(extension);
}
 
export function getExtensionFromFileName(fileName) {
  Eif (fileName && fileName.indexOf(".") !== -1) {
    return fileName
      .substring(fileName.lastIndexOf(".") + 1, fileName.length)
      .toLowerCase();
  }
  return "";
}
 
export function isBrowserSupportedFile(fileName) {
  const extension = getExtensionFromFileName(fileName);
  return BROWSER_SUPPORTED_FILES.indexOf(extension) !== -1;
}