Нема описа

test-0.6.3.js 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import RNTest from './react-native-testkit/'
  2. import React from 'react'
  3. import RNFetchBlob from 'react-native-fetch-blob'
  4. import Timer from 'react-timer-mixin'
  5. import {
  6. StyleSheet,
  7. Text,
  8. View,
  9. ScrollView,
  10. CameraRoll,
  11. Platform,
  12. Dimensions,
  13. Image,
  14. } from 'react-native';
  15. const fs = RNFetchBlob.fs
  16. const { Assert, Comparer, Info, prop } = RNTest
  17. const describe = RNTest.config({
  18. group : '0.6.3',
  19. run : true,
  20. expand : true,
  21. timeout : 300000000,
  22. })
  23. const { TEST_SERVER_URL, TEST_SERVER_URL_SSL, DROPBOX_TOKEN, styles } = prop()
  24. const dirs = RNFetchBlob.fs.dirs
  25. let prefix = ((Platform.OS === 'android') ? 'file://' : '')
  26. describe('massive HTTP request', (report, done) => {
  27. let promises = []
  28. let progress = []
  29. let begin = Date.now()
  30. for(let i=0; i<500;i++) {
  31. let p = RNFetchBlob
  32. .config({fileCache : true})
  33. .fetch('GET', `${TEST_SERVER_URL}/public/github2.jpg`)
  34. promises.push(p)
  35. }
  36. Promise.all(promises).then((resps) => {
  37. for(let i in resps) {
  38. fs.unlink(resps[i].path())
  39. }
  40. report(<Info key={`time = ${(Date.now() - begin) / 1000} sec`}></Info>)
  41. done()
  42. })
  43. })