import { forEach } from 'ramda';

import { getIconForMimeType } from './mime';

describe('getIconForMimeType', () => {
  const testCases = [
    /* eslint-disable max-len */
    ['archive', 'application/gzip'],
    ['archive', 'application/zip'],
    ['audio', 'audio/mp4'],
    ['pdf', 'application/pdf'],
    ['excel', 'application/vnd.ms-excel'],
    ['excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
    ['excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'],
    ['image', 'image/bmp'],
    ['powerpoint', 'application/vnd.ms-powerpoint'],
    ['powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],
    ['powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.template'],
    ['powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'],
    ['video', 'video/mp4'],
    ['word', 'application/msword'],
    ['word', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
    ['word', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'],
    /* eslint-enable max-len */
  ];

  forEach((testCase) => {
    const expected = testCase[0];
    const type = testCase[1];

    it(`identifies the correct icon for ${type}`, () => {
      expect(getIconForMimeType(type)).toBe(expected);
    });
  }, testCases);

  it('returns undefined for unknown types', () => {
    expect(getIconForMimeType('application/vdn.storyshare.export'))
      .toBeUndefined();
  });
});
