mirror of
https://github.com/strapi/strapi.git
synced 2025-10-08 06:41:06 +00:00
39 lines
1002 B
JavaScript
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);
|
|
});
|
|
});
|