soupette 80e6fb7d8b Fix bug when file is empty
Signed-off-by: soupette <cyril.lpz@gmail.com>
2020-03-27 14:29:04 +01:00

39 lines
1002 B
JavaScript

import getExtension from '../getExtension';
describe('UPLOAD | utils | getExtension', () => {
it('should return undefined if mime does not exits', () => {
const mime = null;
const expected = 'undefined';
expect(getExtension(mime)).toEqual(expected);
});
it('should return png if mime string is image/png', () => {
const mime = 'image/png';
const expected = 'png';
expect(getExtension(mime)).toEqual(expected);
});
it('should return mp4 if mime string is video/mp4', () => {
const mime = 'video/mp4';
const expected = 'mp4';
expect(getExtension(mime)).toEqual(expected);
});
it('should return html if mime string is text/html', () => {
const mime = 'text/html';
const expected = 'html';
expect(getExtension(mime)).toEqual(expected);
});
it('should return pdf if mime string is application/pdf', () => {
const mime = 'application/pdf';
const expected = 'pdf';
expect(getExtension(mime)).toEqual(expected);
});
});