1+ // tslint:disable: forin
12import { COMMON_MIME_TYPES , toFileWithPath } from './file' ;
23
34describe ( 'toFile()' , ( ) => {
@@ -22,6 +23,21 @@ describe('toFile()', () => {
2223 expect ( fileWithPath . path ) . toBe ( path ) ;
2324 } ) ;
2425
26+ test ( '{path} is enumerable' , ( ) => {
27+ const path = '/test/test.json' ;
28+ const file = new File ( [ ] , 'test.json' ) ;
29+ const fileWithPath = toFileWithPath ( file , path ) ;
30+
31+ expect ( Object . keys ( fileWithPath ) ) . toContain ( 'path' ) ;
32+
33+ const keys = [ ] ;
34+ for ( const key in fileWithPath ) {
35+ keys . push ( key ) ;
36+ }
37+
38+ expect ( keys ) . toContain ( 'path' ) ;
39+ } ) ;
40+
2541 it ( 'uses the File {name} as {path} if not provided' , ( ) => {
2642 const name = 'test.json' ;
2743 const file = new File ( [ ] , name ) ;
@@ -50,6 +66,20 @@ describe('toFile()', () => {
5066 }
5167 } ) ;
5268
69+ test ( '{type} is enumerable' , ( ) => {
70+ const file = new File ( [ ] , 'test.gif' ) ;
71+ const fileWithPath = toFileWithPath ( file ) ;
72+
73+ expect ( Object . keys ( fileWithPath ) ) . toContain ( 'type' ) ;
74+
75+ const keys = [ ] ;
76+ for ( const key in fileWithPath ) {
77+ keys . push ( key ) ;
78+ }
79+
80+ expect ( keys ) . toContain ( 'type' ) ;
81+ } ) ;
82+
5383 it ( 'sets the {type} from extension regardless of case' , ( ) => {
5484 const types = Array . from ( COMMON_MIME_TYPES . values ( ) ) ;
5585 const files = Array . from ( COMMON_MIME_TYPES . keys ( ) )
0 commit comments