mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-09-12 11:37:39 +01:00
Add MIME type module
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
exports.isJPEG = mimeType =>
|
||||
mimeType === 'image/jpeg' ||
|
||||
mimeType === 'image/jpg';
|
||||
@@ -0,0 +1,23 @@
|
||||
const { assert } = require('chai');
|
||||
|
||||
const MIME = require('../../../js/modules/types/mime');
|
||||
|
||||
|
||||
describe('MIME', () => {
|
||||
describe('isJPEG', () => {
|
||||
it('should return true for `image/jpeg`', () => {
|
||||
assert.isTrue(MIME.isJPEG('image/jpeg'));
|
||||
});
|
||||
|
||||
it('should return true for `image/jpg`', () => {
|
||||
assert.isTrue(MIME.isJPEG('image/jpeg'));
|
||||
});
|
||||
|
||||
['image/gif', 'image/tiff', 'application/json', 0, false, null, undefined]
|
||||
.forEach((value) => {
|
||||
it(`should return false for \`${value}\``, () => {
|
||||
assert.isFalse(MIME.isJPEG(value));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user