Bez popisu

test-background.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import RNTest from './react-native-testkit/'
  2. import React from 'react'
  3. import RNFetchBlob from 'react-native-fetch-blob'
  4. import {
  5. StyleSheet,
  6. Text,
  7. View,
  8. ScrollView,
  9. Linking,
  10. Platform,
  11. Dimensions,
  12. AsyncStorage,
  13. Image,
  14. } from 'react-native';
  15. const JSONStream = RNFetchBlob.JSONStream
  16. const fs = RNFetchBlob.fs
  17. const { Assert, Comparer, Info, prop } = RNTest
  18. const describe = RNTest.config({
  19. group : 'background',
  20. run : true,
  21. expand : true,
  22. timeout : 20000,
  23. })
  24. const { TEST_SERVER_URL, TEST_SERVER_URL_SSL, FILENAME, DROPBOX_TOKEN, styles } = prop()
  25. const dirs = RNFetchBlob.fs.dirs
  26. let prefix = ((Platform.OS === 'android') ? 'file://' : '')
  27. let begin = Date.now()
  28. describe('background http response', (report, done) => {
  29. let count = 0
  30. let task = RNFetchBlob.config({
  31. timeout : -1
  32. }).fetch('GET', `${TEST_SERVER_URL}/long/3600`, {
  33. 'Cache-Control' : 'no-store'
  34. })
  35. task.expire(() => {
  36. done()
  37. })
  38. task.catch((err) => {
  39. console.log(err)
  40. })
  41. task.then((res) => {
  42. console.log('resp response received', res.data.length)
  43. // done()
  44. })
  45. })