<commit_before>import get from 'lodash/get'
import { getFileMimetype } from 'drive/lib/getFileMimetype'

import IconFolder from 'drive/assets/icons/icon-type-folder.svg'
import IconAudio from 'drive/assets/icons/icon-type-audio.svg'
import IconBin from 'drive/assets/icons/icon-type-bin.svg'
import IconCode from 'drive/assets/icons/icon-type-code.svg'
import IconFiles from 'drive/assets/icons/icon-type-files.svg'
import IconImage from 'drive/assets/icons/icon-type-image.svg'
import IconPdf from 'drive/assets/icons/icon-type-pdf.svg'
import IconSlide from 'drive/assets/icons/icon-type-slide.svg'
import IconSheet from 'drive/assets/icons/icon-type-sheet.svg'
import IconText from 'drive/assets/icons/icon-type-text.svg'
import IconVideo from 'drive/assets/icons/icon-type-video.svg'
import IconZip from 'drive/assets/icons/icon-type-zip.svg'
import IconNote from 'drive/assets/icons/icon-type-note.svg'

const getMimeTypeIcon = (isDirectory, name, mime) => {
  if (isDirectory) {
    return IconFolder
  } else if (/\.cozynote$/.test(name)) {
    return IconNote
  } else {
    const iconsByMimeType = {
      audio: IconAudio,
      bin: IconBin,
      code: IconCode,
      image: IconImage,
      pdf: IconPdf,
      slide: IconSlide,
      sheet: IconSheet,
      text: IconText,
      video: IconVideo,
      zip: IconZip
    }
    const type = getFileMimetype(iconsByMimeType)(mime, name)
    return get(iconsByMimeType, type, IconFiles)
  }
}

export default getMimeTypeIcon<commit_msg>fix: Cozy-note test<commit_after>import get from 'lodash/get'
import { getFileMimetype } from 'drive/lib/getFileMimetype'

import IconFolder from 'drive/assets/icons/icon-type-folder.svg'
import IconAudio from 'drive/assets/icons/icon-type-audio.svg'
import IconBin from 'drive/assets/icons/icon-type-bin.svg'
import IconCode from 'drive/assets/icons/icon-type-code.svg'
import IconFiles from 'drive/assets/icons/icon-type-files.svg'
import IconImage from 'drive/assets/icons/icon-type-image.svg'
import IconPdf from 'drive/assets/icons/icon-type-pdf.svg'
import IconSlide from 'drive/assets/icons/icon-type-slide.svg'
import IconSheet from 'drive/assets/icons/icon-type-sheet.svg'
import IconText from 'drive/assets/icons/icon-type-text.svg'
import IconVideo from 'drive/assets/icons/icon-type-video.svg'
import IconZip from 'drive/assets/icons/icon-type-zip.svg'
import IconNote from 'drive/assets/icons/icon-type-note.svg'

const getMimeTypeIcon = (isDirectory, name, mime) => {
  if (isDirectory) {
    return IconFolder
  } else if (/\.cozy-note$/.test(name)) {
    return IconNote
  } else {
    const iconsByMimeType = {
      audio: IconAudio,
      bin: IconBin,
      code: IconCode,
      image: IconImage,
      pdf: IconPdf,
      slide: IconSlide,
      sheet: IconSheet,
      text: IconText,
      video: IconVideo,
      zip: IconZip
    }
    const type = getFileMimetype(iconsByMimeType)(mime, name)
    return get(iconsByMimeType, type, IconFiles)
  }
}

export default getMimeTypeIcon
{'fraction_non_alphanumeric': 0.11754911754911755, 'fraction_numerical': 0.0, 'mean_word_length': 3.900489396411093, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '342547', 'n_tokens_mistral': 1013, 'n_tokens_neox': 1001, 'n_words': 217}