isPreviewSupported.test.js 527 B

123456789101112
  1. import { describe, expect, it } from '@jest/globals'
  2. import isPreviewSupported from './isPreviewSupported.js'
  3. describe('isPreviewSupported', () => {
  4. it('should return true for any filetypes that browsers can preview', () => {
  5. const supported = ['image/jpeg', 'image/gif', 'image/png', 'image/svg', 'image/svg+xml', 'image/bmp', 'image/jpg', 'image/webp', 'image/avif']
  6. supported.forEach(ext => {
  7. expect(isPreviewSupported(ext)).toEqual(true)
  8. })
  9. expect(isPreviewSupported('foo')).toEqual(false)
  10. })
  11. })