@@ -64,18 +64,21 @@ describe('ParseFile', () => {
6464 const file = new ParseFile ( 'parse.txt' , { base64 : 'YWJj' } ) ;
6565 expect ( file . _source . base64 ) . toBe ( 'YWJj' ) ;
6666 expect ( file . _source . type ) . toBe ( 'text/plain' ) ;
67+ expect ( file . _data ) . toBe ( 'YWJj' ) ;
6768 } ) ;
6869
6970 it ( 'can create files with base64 encoding (1 padding)' , ( ) => {
7071 const file = new ParseFile ( 'parse.txt' , { base64 : 'YWI=' } ) ;
7172 expect ( file . _source . base64 ) . toBe ( 'YWI=' ) ;
7273 expect ( file . _source . type ) . toBe ( 'text/plain' ) ;
74+ expect ( file . _data ) . toBe ( 'YWI=' ) ;
7375 } ) ;
7476
7577 it ( 'can create files with base64 encoding (2 padding)' , ( ) => {
7678 const file = new ParseFile ( 'parse.txt' , { base64 : 'ParseA==' } ) ;
7779 expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
7880 expect ( file . _source . type ) . toBe ( 'text/plain' ) ;
81+ expect ( file . _data ) . toBe ( 'ParseA==' ) ;
7982 } ) ;
8083
8184 it ( 'can set the default type to be text/plain when using base64' , ( ) => {
@@ -84,6 +87,7 @@ describe('ParseFile', () => {
8487 } ) ;
8588 expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
8689 expect ( file . _source . type ) . toBe ( 'text/plain' ) ;
90+ expect ( file . _data ) . toBe ( 'ParseA==' ) ;
8791 } ) ;
8892
8993 it ( 'can extract data type from base64' , ( ) => {
@@ -92,6 +96,7 @@ describe('ParseFile', () => {
9296 } ) ;
9397 expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
9498 expect ( file . _source . type ) . toBe ( 'image/png' ) ;
99+ expect ( file . _data ) . toBe ( 'ParseA==' ) ;
95100 } ) ;
96101
97102 it ( 'can extract data type from base64 with a filename parameter' , ( ) => {
@@ -100,6 +105,7 @@ describe('ParseFile', () => {
100105 } ) ;
101106 expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
102107 expect ( file . _source . type ) . toBe ( 'application/pdf' ) ;
108+ expect ( file . _data ) . toBe ( 'ParseA==' ) ;
103109 } ) ;
104110
105111 it ( 'can create files with file uri' , ( ) => {
@@ -116,6 +122,7 @@ describe('ParseFile', () => {
116122 } ) ;
117123 expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
118124 expect ( file . _source . type ) . toBe ( 'audio/m4a' ) ;
125+ expect ( file . _data ) . toBe ( 'ParseA==' ) ;
119126 } ) ;
120127
121128 it ( 'can extract data type from base64 with a complex mime type' , ( ) => {
@@ -124,6 +131,7 @@ describe('ParseFile', () => {
124131 } ) ;
125132 expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
126133 expect ( file . _source . type ) . toBe ( 'application/vnd.google-earth.kml+xml' ) ;
134+ expect ( file . _data ) . toBe ( 'ParseA==' ) ;
127135 } ) ;
128136
129137 it ( 'can extract data type from base64 with a charset param' , ( ) => {
@@ -132,18 +140,21 @@ describe('ParseFile', () => {
132140 } ) ;
133141 expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
134142 expect ( file . _source . type ) . toBe ( 'application/vnd.3gpp.pic-bw-var' ) ;
143+ expect ( file . _data ) . toBe ( 'ParseA==' ) ;
135144 } ) ;
136145
137146 it ( 'can create files with byte arrays' , ( ) => {
138147 const file = new ParseFile ( 'parse.txt' , [ 61 , 170 , 236 , 120 ] ) ;
139148 expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
140149 expect ( file . _source . type ) . toBe ( '' ) ;
150+ expect ( file . _data ) . toBe ( 'ParseA==' ) ;
141151 } ) ;
142152
143153 it ( 'can create files with all types of characters' , ( ) => {
144154 const file = new ParseFile ( 'parse.txt' , [ 11 , 239 , 191 , 215 , 80 , 52 ] ) ;
145155 expect ( file . _source . base64 ) . toBe ( 'C++/11A0' ) ;
146156 expect ( file . _source . type ) . toBe ( '' ) ;
157+ expect ( file . _data ) . toBe ( 'C++/11A0' ) ;
147158 } ) ;
148159
149160 it ( 'can create an empty file' , ( ) => {
@@ -341,6 +352,7 @@ describe('ParseFile', () => {
341352 const file = new ParseFile ( 'parse.txt' , [ 61 , 170 , 236 , 120 ] , '' , metadata , tags ) ;
342353 expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
343354 expect ( file . _source . type ) . toBe ( '' ) ;
355+ expect ( file . _data ) . toBe ( 'ParseA==' ) ;
344356 expect ( file . metadata ( ) ) . toBe ( metadata ) ;
345357 expect ( file . tags ( ) ) . toBe ( tags ) ;
346358 } ) ;
0 commit comments