1
+ // tslint:disable: forin
1
2
import { COMMON_MIME_TYPES , toFileWithPath } from './file' ;
2
3
3
4
describe ( 'toFile()' , ( ) => {
@@ -22,6 +23,21 @@ describe('toFile()', () => {
22
23
expect ( fileWithPath . path ) . toBe ( path ) ;
23
24
} ) ;
24
25
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
+
25
41
it ( 'uses the File {name} as {path} if not provided' , ( ) => {
26
42
const name = 'test.json' ;
27
43
const file = new File ( [ ] , name ) ;
@@ -50,6 +66,20 @@ describe('toFile()', () => {
50
66
}
51
67
} ) ;
52
68
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
+
53
83
it ( 'sets the {type} from extension regardless of case' , ( ) => {
54
84
const types = Array . from ( COMMON_MIME_TYPES . values ( ) ) ;
55
85
const files = Array . from ( COMMON_MIME_TYPES . keys ( ) )
0 commit comments