@@ -64,18 +64,21 @@ describe('ParseFile', () => {
64
64
const file = new ParseFile ( 'parse.txt' , { base64 : 'YWJj' } ) ;
65
65
expect ( file . _source . base64 ) . toBe ( 'YWJj' ) ;
66
66
expect ( file . _source . type ) . toBe ( 'text/plain' ) ;
67
+ expect ( file . _data ) . toBe ( 'YWJj' ) ;
67
68
} ) ;
68
69
69
70
it ( 'can create files with base64 encoding (1 padding)' , ( ) => {
70
71
const file = new ParseFile ( 'parse.txt' , { base64 : 'YWI=' } ) ;
71
72
expect ( file . _source . base64 ) . toBe ( 'YWI=' ) ;
72
73
expect ( file . _source . type ) . toBe ( 'text/plain' ) ;
74
+ expect ( file . _data ) . toBe ( 'YWI=' ) ;
73
75
} ) ;
74
76
75
77
it ( 'can create files with base64 encoding (2 padding)' , ( ) => {
76
78
const file = new ParseFile ( 'parse.txt' , { base64 : 'ParseA==' } ) ;
77
79
expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
78
80
expect ( file . _source . type ) . toBe ( 'text/plain' ) ;
81
+ expect ( file . _data ) . toBe ( 'ParseA==' ) ;
79
82
} ) ;
80
83
81
84
it ( 'can set the default type to be text/plain when using base64' , ( ) => {
@@ -84,6 +87,7 @@ describe('ParseFile', () => {
84
87
} ) ;
85
88
expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
86
89
expect ( file . _source . type ) . toBe ( 'text/plain' ) ;
90
+ expect ( file . _data ) . toBe ( 'ParseA==' ) ;
87
91
} ) ;
88
92
89
93
it ( 'can extract data type from base64' , ( ) => {
@@ -92,6 +96,7 @@ describe('ParseFile', () => {
92
96
} ) ;
93
97
expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
94
98
expect ( file . _source . type ) . toBe ( 'image/png' ) ;
99
+ expect ( file . _data ) . toBe ( 'ParseA==' ) ;
95
100
} ) ;
96
101
97
102
it ( 'can extract data type from base64 with a filename parameter' , ( ) => {
@@ -100,6 +105,7 @@ describe('ParseFile', () => {
100
105
} ) ;
101
106
expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
102
107
expect ( file . _source . type ) . toBe ( 'application/pdf' ) ;
108
+ expect ( file . _data ) . toBe ( 'ParseA==' ) ;
103
109
} ) ;
104
110
105
111
it ( 'can create files with file uri' , ( ) => {
@@ -116,6 +122,7 @@ describe('ParseFile', () => {
116
122
} ) ;
117
123
expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
118
124
expect ( file . _source . type ) . toBe ( 'audio/m4a' ) ;
125
+ expect ( file . _data ) . toBe ( 'ParseA==' ) ;
119
126
} ) ;
120
127
121
128
it ( 'can extract data type from base64 with a complex mime type' , ( ) => {
@@ -124,6 +131,7 @@ describe('ParseFile', () => {
124
131
} ) ;
125
132
expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
126
133
expect ( file . _source . type ) . toBe ( 'application/vnd.google-earth.kml+xml' ) ;
134
+ expect ( file . _data ) . toBe ( 'ParseA==' ) ;
127
135
} ) ;
128
136
129
137
it ( 'can extract data type from base64 with a charset param' , ( ) => {
@@ -132,18 +140,21 @@ describe('ParseFile', () => {
132
140
} ) ;
133
141
expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
134
142
expect ( file . _source . type ) . toBe ( 'application/vnd.3gpp.pic-bw-var' ) ;
143
+ expect ( file . _data ) . toBe ( 'ParseA==' ) ;
135
144
} ) ;
136
145
137
146
it ( 'can create files with byte arrays' , ( ) => {
138
147
const file = new ParseFile ( 'parse.txt' , [ 61 , 170 , 236 , 120 ] ) ;
139
148
expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
140
149
expect ( file . _source . type ) . toBe ( '' ) ;
150
+ expect ( file . _data ) . toBe ( 'ParseA==' ) ;
141
151
} ) ;
142
152
143
153
it ( 'can create files with all types of characters' , ( ) => {
144
154
const file = new ParseFile ( 'parse.txt' , [ 11 , 239 , 191 , 215 , 80 , 52 ] ) ;
145
155
expect ( file . _source . base64 ) . toBe ( 'C++/11A0' ) ;
146
156
expect ( file . _source . type ) . toBe ( '' ) ;
157
+ expect ( file . _data ) . toBe ( 'C++/11A0' ) ;
147
158
} ) ;
148
159
149
160
it ( 'can create an empty file' , ( ) => {
@@ -341,6 +352,7 @@ describe('ParseFile', () => {
341
352
const file = new ParseFile ( 'parse.txt' , [ 61 , 170 , 236 , 120 ] , '' , metadata , tags ) ;
342
353
expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
343
354
expect ( file . _source . type ) . toBe ( '' ) ;
355
+ expect ( file . _data ) . toBe ( 'ParseA==' ) ;
344
356
expect ( file . metadata ( ) ) . toBe ( metadata ) ;
345
357
expect ( file . tags ( ) ) . toBe ( tags ) ;
346
358
} ) ;
0 commit comments