mirror of
https://github.com/Warky-Devs/artemis-kit.git
synced 2026-02-01 23:44:27 +00:00
Test cases and minor function fixes
This commit is contained in:
25
src/mime/index.test.ts
Normal file
25
src/mime/index.test.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { getExtFromMime, getExtFromFilename, getMimeFromExt, isValidExtForMime, getAllExtensionsForMime } from './index'
|
||||
|
||||
describe('MIME functions', () => {
|
||||
it('should get the correct extension from MIME type', () => {
|
||||
expect(getExtFromMime('image/jpeg')).toBe('jpg')
|
||||
})
|
||||
|
||||
it('should get the correct extension from filename', () => {
|
||||
expect(getExtFromFilename('example.txt')).toBe('txt')
|
||||
})
|
||||
|
||||
it('should get the correct MIME type from extension', () => {
|
||||
expect(getMimeFromExt('txt')).toBe('text/plain')
|
||||
})
|
||||
|
||||
it('should validate if extension is valid for MIME type', () => {
|
||||
expect(isValidExtForMime('image/jpeg', 'jpg')).toBe(true)
|
||||
expect(isValidExtForMime('image/jpeg', 'png')).toBe(false)
|
||||
})
|
||||
|
||||
it('should get all valid extensions for a MIME type', () => {
|
||||
expect(getAllExtensionsForMime('image/jpeg')).toEqual(['jpg', 'jpe', 'jpeg','jfif'])
|
||||
})
|
||||
})
|
||||
@@ -7410,7 +7410,7 @@ export const MimeTypeList :MimeTypes = {
|
||||
'image/jpeg': {
|
||||
source: 'iana',
|
||||
compressible: false,
|
||||
extensions: ['jpeg', 'jpg', 'jpe', 'jfif'],
|
||||
extensions: [ 'jpg', 'jpe', 'jpeg','jfif'],
|
||||
},
|
||||
'image/jph': {
|
||||
source: 'iana',
|
||||
|
||||
Reference in New Issue
Block a user