import { getFileType } from '.';

const imageFile = new Blob(undefined, { type: 'image/png' });

const data64Img = 'data:image/png;something';

describe('getFileType', () => {
  describe('returns empty string', () => {
    it(`when file has empty type and file64 hasn't been provided`, () => {
      expect(getFileType(new Blob())).toBe('');
    });
  });

  describe('returns file-type', () => {
    it('when file has type defined', () => {
      expect(getFileType(imageFile)).toBe(imageFile.type);
    });
    it('when file has no type and file64 is supported', () => {
      expect(getFileType(new Blob(), data64Img)).toBe('image/png');
    });
  });
});
