import RNTest from './react-native-testkit/' import React from 'react' import RNFetchBlob from 'react-native-fetch-blob' import Timer from 'react-timer-mixin' import { StyleSheet, Text, View, ScrollView, CameraRoll, Platform, Dimensions, Image, } from 'react-native'; const fs = RNFetchBlob.fs const { Assert, Comparer, Info, prop } = RNTest const describe = RNTest.config({ group : 'stress test', run : true, expand : true, timeout : 300000000, }) const { TEST_SERVER_URL, TEST_SERVER_URL_SSL, DROPBOX_TOKEN, styles } = prop() const dirs = RNFetchBlob.fs.dirs let prefix = ((Platform.OS === 'android') ? 'file://' : '') describe('massive HTTP request', (report, done) => { let promises = [] let progress = [] let iteration = 500 let begin = Date.now() let finished = 0 let success = 0 for(let i=0; i { finished ++ let info = res.info() if(info.status == 200 && info.headers['Content-Length'] == '23975') { success ++ } report() fs.unlink(res.path()).catch(() => {}) if(finished >= iteration) summary() }) .catch((err) => { finished++ report() if(finished >= iteration){ summary() } }) } function summary() { report( {`${success} success`} ) done() } })