@@ -38,14 +38,38 @@ describe('ParseFile', () => {
38
38
expect ( file . _source . type ) . toBe ( '' ) ;
39
39
} ) ;
40
40
41
- it ( 'can extact data type from base64' , ( ) => {
41
+ it ( 'can extract data type from base64' , ( ) => {
42
42
var file = new ParseFile ( 'parse.txt' , {
43
43
base64 : 'data:image/png;base64,ParseA=='
44
44
} ) ;
45
45
expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
46
46
expect ( file . _source . type ) . toBe ( 'image/png' ) ;
47
47
} ) ;
48
48
49
+ it ( 'can extract data type from base64 with data type containing a number' , ( ) => {
50
+ var file = new ParseFile ( 'parse.m4a' , {
51
+ base64 : 'data:audio/m4a;base64,ParseA=='
52
+ } ) ;
53
+ expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
54
+ expect ( file . _source . type ) . toBe ( 'audio/m4a' ) ;
55
+ } ) ;
56
+
57
+ it ( 'can extract data type from base64 with a complex mime type' , ( ) => {
58
+ var file = new ParseFile ( 'parse.kml' , {
59
+ base64 : 'data:application/vnd.google-earth.kml+xml;base64,ParseA=='
60
+ } ) ;
61
+ expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
62
+ expect ( file . _source . type ) . toBe ( 'application/vnd.google-earth.kml+xml' ) ;
63
+ } ) ;
64
+
65
+ it ( 'can extract data type from base64 with a charset param' , ( ) => {
66
+ var file = new ParseFile ( 'parse.kml' , {
67
+ base64 : 'data:application/vnd.3gpp.pic-bw-var;charset=utf-8;base64,ParseA=='
68
+ } ) ;
69
+ expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
70
+ expect ( file . _source . type ) . toBe ( 'application/vnd.3gpp.pic-bw-var' ) ;
71
+ } ) ;
72
+
49
73
it ( 'can create files with byte arrays' , ( ) => {
50
74
var file = new ParseFile ( 'parse.txt' , [ 61 , 170 , 236 , 120 ] ) ;
51
75
expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
0 commit comments