@@ -13,8 +13,10 @@ import {
1313 AsyncStorage ,
1414 Image ,
1515} from 'react-native' ;
16+
1617window . XMLHttpRequest = RNFetchBlob . polyfill . XMLHttpRequest
1718window . Blob = RNFetchBlob . polyfill . Blob
19+
1820const JSONStream = RNFetchBlob . JSONStream
1921const fs = RNFetchBlob . fs
2022const { Assert, Comparer, Info, prop } = RNTest
@@ -99,11 +101,17 @@ describe('SSL test #159', (report, done) => {
99101 'Cache-Control' : 'no-store'
100102 } )
101103 . 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 } /> )
103108 return RNFetchBlob . fetch ( 'GET' , `${ TEST_SERVER_URL_SSL } /public/github.png` )
104109 } )
105110 . 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 } /> )
107115 done ( )
108116 } )
109117} )
@@ -118,11 +126,18 @@ describe('#171 appendExt verify', (report, done) => {
118126 'Cache-Control' : 'no-store'
119127 } )
120128 . 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 } /> )
122134 return fs . stat ( res . path ( ) )
123135 } )
124136 . 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 } /> )
126141 done ( )
127142 } )
128143
@@ -137,7 +152,10 @@ describe('#173 issue with append option', (report, done) => {
137152 . fetch ( 'GET' , `${ TEST_SERVER_URL } /public/github.png` )
138153 . then ( ( res ) => fs . stat ( res . path ( ) ) )
139154 . 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 } /> )
141159 return RNFetchBlob . config ( {
142160 path : dest ,
143161 overwrite : false
@@ -146,7 +164,10 @@ describe('#173 issue with append option', (report, done) => {
146164 } )
147165 . then ( ( res ) => fs . stat ( res . path ( ) ) )
148166 . 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 } /> )
150171 return RNFetchBlob . config ( {
151172 path : dest ,
152173 overwrite : true
@@ -155,18 +176,39 @@ describe('#173 issue with append option', (report, done) => {
155176 } )
156177 . then ( ( res ) => fs . stat ( res . path ( ) ) )
157178 . 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 } /> )
159183 return RNFetchBlob . config ( {
160184 path : dest ,
161185 } )
162186 . fetch ( 'GET' , `${ TEST_SERVER_URL } /public/github.png` )
163187 } )
164188 . then ( ( res ) => fs . stat ( res . path ( ) ) )
165189 . 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"
167192 expect = "23975"
168193 actual = { stat . size } /> )
169194 done ( )
170195 } )
171196
172197} )
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