|
- import * as fc from 'fast-check'
- import Blob from './Blob'
-
- jest.mock('./isBrowser', function IsBrowser() {
- return () => false
- })
-
- it('should exist', () => {
- expect(Blob).toBeDefined()
- })
-
- it('should be a callable', () => {
- expect(typeof Blob).toBe('function')
- })
-
- describe('instances', () => {
- it('should contain a type', () => {
- fc.assert(
- fc.property(
- fc.tuple(
- fc.oneof(
- fc.constant('application'),
- fc.constant('font'),
- fc.constant('audio'),
- fc.constant('model'),
- fc.constant('video'),
- fc.constant('text')
- ),
- fc.string().filter(s => /^[a-zA-Z0-9._-]+$/.test(s))
- ),
- mimeTypeFragments => {
- const file = new Blob([], { type: mimeTypeFragments.join('/') })
- expect(file).toHaveProperty('type', mimeTypeFragments.join('/').toLowerCase())
- }
- )
- )
- })
- })
|