99 Platform ,
1010 Dimensions ,
1111 Image ,
12+ TouchableOpacity ,
1213} from 'react-native' ;
1314
1415window . XMLHttpRequest = RNFetchBlob . polyfill . XMLHttpRequest
@@ -65,6 +66,7 @@ describe('issue #106', (report, done) => {
6566describe ( 'issue #111 get redirect destination' , ( report , done ) => {
6667 RNFetchBlob . fetch ( 'GET' , `${ TEST_SERVER_URL } /redirect` )
6768 . then ( ( res ) => {
69+ console . log ( res . info ( ) )
6870 report (
6971 < Assert key = "redirect history should tracable"
7072 expect = { 2 }
@@ -107,27 +109,40 @@ describe('chunked encoding option test', (report, done) => {
107109describe ( '#118 readStream performance prepare the file' , ( report , done ) => {
108110 let cache = null
109111 let size = 0
112+ let size2 = 0
110113 let tick = Date . now ( )
114+ let tick2 = Date . now ( )
111115 let start = - 1
116+ let start2 = - 1
112117 let count = 0
113118
114- RNFetchBlob . config ( { fileCache : true } )
119+ let task = RNFetchBlob . config ( { fileCache : true } )
115120 . fetch ( 'GET' , `${ TEST_SERVER_URL } /public/22mb-dummy` )
116- . then ( ( res ) => {
121+ task . progress ( ( current , total ) => {
122+ report ( < Info key = "prepare file" uid = "prepare" >
123+ < Text key = "pg" > { Math . floor ( current / total * 100 ) } % </ Text >
124+ </ Info > )
125+ } )
126+ task . then ( ( res ) => {
117127 report ( < Info key = "preparation complete" > < Text > start in 3 seconds</ Text > </ Info > )
118128 cache = res . path ( )
119- setTimeout ( ( ) => {
120- fs . readStream ( cache , 'utf8' , 1024000 )
129+ setTimeout ( readFile , 2500 )
130+ function readFile ( ) {
131+ fs . readStream ( cache , 'utf8' , 102400 , 10 )
121132 . then ( ( stream ) => {
122133 stream . open ( )
123134 start = Date . now ( )
124135 stream . onData ( ( chunk ) => {
125136 count ++
126137 size += chunk . length
127138 if ( Date . now ( ) - tick > 500 ) {
139+ console . log ( size , ' read' )
128140 tick = Date . now ( )
129141 report (
130- < Info key = "size" uid = "100" > < Text > { size } bytes read</ Text > </ Info > )
142+ < Info key = "size" uid = "100" >
143+ < Text key = "AA" > File 1 { size } /22000000 bytes read</ Text >
144+ < Text key = "BB" > File 2 { size2 } /22000000 bytes read</ Text >
145+ </ Info > )
131146 }
132147 } )
133148 stream . onEnd ( ( ) => {
@@ -144,7 +159,7 @@ describe('#118 readStream performance prepare the file', (report, done) => {
144159 } )
145160 } )
146161 } )
147- } , 3000 )
162+ }
148163 } )
149164} )
150165
0 commit comments