@@ -13,8 +13,10 @@ import {
13
13
AsyncStorage ,
14
14
Image ,
15
15
} from 'react-native' ;
16
+
16
17
window . XMLHttpRequest = RNFetchBlob . polyfill . XMLHttpRequest
17
18
window . Blob = RNFetchBlob . polyfill . Blob
19
+
18
20
const JSONStream = RNFetchBlob . JSONStream
19
21
const fs = RNFetchBlob . fs
20
22
const { Assert, Comparer, Info, prop } = RNTest
@@ -99,11 +101,17 @@ describe('SSL test #159', (report, done) => {
99
101
'Cache-Control' : 'no-store'
100
102
} )
101
103
. then ( res => {
102
- report ( < Assert key = "trusty request should pass" expect = { true } actual = { true } /> )
104
+ report ( < Assert
105
+ key = "trusty request should pass"
106
+ expect = { true }
107
+ actual = { true } /> )
103
108
return RNFetchBlob . fetch ( 'GET' , `${ TEST_SERVER_URL_SSL } /public/github.png` )
104
109
} )
105
110
. catch ( e => {
106
- report ( < Assert key = "non-trusty request should not pass" expect = { true } actual = { true } /> )
111
+ report ( < Assert
112
+ key = "non-trusty request should not pass"
113
+ expect = { true }
114
+ actual = { true } /> )
107
115
done ( )
108
116
} )
109
117
} )
@@ -118,11 +126,18 @@ describe('#171 appendExt verify', (report, done) => {
118
126
'Cache-Control' : 'no-store'
119
127
} )
120
128
. then ( res => {
121
- report ( < Assert key = "extension appended to tmp path" actual = { / .p n g $ / . test ( res . path ( ) ) } expect = { true } /> )
129
+ console . log ( res . path ( ) )
130
+ report ( < Assert
131
+ key = "extension appended to tmp path"
132
+ actual = { / .p n g $ / . test ( res . path ( ) ) }
133
+ expect = { true } /> )
122
134
return fs . stat ( res . path ( ) )
123
135
} )
124
136
. then ( stat => {
125
- report ( < Assert key = "verify the file existence" expect = "23975" actual = { stat . size } /> )
137
+ report ( < Assert
138
+ key = "verify the file existence"
139
+ expect = "23975"
140
+ actual = { stat . size } /> )
126
141
done ( )
127
142
} )
128
143
@@ -137,7 +152,10 @@ describe('#173 issue with append option', (report, done) => {
137
152
. fetch ( 'GET' , `${ TEST_SERVER_URL } /public/github.png` )
138
153
. then ( ( res ) => fs . stat ( res . path ( ) ) )
139
154
. then ( ( stat ) => {
140
- report ( < Assert key = "file size check #1" expect = "23975" actual = { stat . size } /> )
155
+ report ( < Assert
156
+ key = "file size check #1"
157
+ expect = "23975"
158
+ actual = { stat . size } /> )
141
159
return RNFetchBlob . config ( {
142
160
path : dest ,
143
161
overwrite : false
@@ -146,7 +164,10 @@ describe('#173 issue with append option', (report, done) => {
146
164
} )
147
165
. then ( ( res ) => fs . stat ( res . path ( ) ) )
148
166
. then ( ( stat ) => {
149
- report ( < Assert key = "file size check #2" expect = "47950" actual = { stat . size } /> )
167
+ report ( < Assert
168
+ key = "file size check #2"
169
+ expect = "47950"
170
+ actual = { stat . size } /> )
150
171
return RNFetchBlob . config ( {
151
172
path : dest ,
152
173
overwrite : true
@@ -155,18 +176,39 @@ describe('#173 issue with append option', (report, done) => {
155
176
} )
156
177
. then ( ( res ) => fs . stat ( res . path ( ) ) )
157
178
. then ( ( stat ) => {
158
- report ( < Assert key = "file size check #3" expect = "23975" actual = { stat . size } /> )
179
+ report ( < Assert
180
+ key = "file size check #3"
181
+ expect = "23975"
182
+ actual = { stat . size } /> )
159
183
return RNFetchBlob . config ( {
160
184
path : dest ,
161
185
} )
162
186
. fetch ( 'GET' , `${ TEST_SERVER_URL } /public/github.png` )
163
187
} )
164
188
. then ( ( res ) => fs . stat ( res . path ( ) ) )
165
189
. then ( ( stat ) => {
166
- report ( < Assert key = "it should successfully overwrite existing file without config"
190
+ report ( < Assert
191
+ key = "it should successfully overwrite existing file without config"
167
192
expect = "23975"
168
193
actual = { stat . size } /> )
169
194
done ( )
170
195
} )
171
196
172
197
} )
198
+
199
+ describe ( '#171 verification ' , ( report , done ) => {
200
+
201
+ RNFetchBlob
202
+ . config ( {
203
+ session : 'SESSION_NAME' ,
204
+ fileCache : true ,
205
+ appendExt : 'mp4'
206
+ } )
207
+ . fetch ( 'GET' , `${ TEST_SERVER_URL } /public/cat-fu.mp4` )
208
+ . then ( res => {
209
+ console . log ( res . path ( ) )
210
+ } )
211
+
212
+
213
+
214
+ } )
0 commit comments