|
@@ -0,0 +1,51 @@
|
|
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
|
+
|
|
29
|
+describe('background http response', (report, done) => {
|
|
30
|
+ let count = 0
|
|
31
|
+
|
|
32
|
+ let task = RNFetchBlob.config({
|
|
33
|
+ timeout : -1
|
|
34
|
+ }).fetch('GET', `${TEST_SERVER_URL}/long/3600`, {
|
|
35
|
+ 'Cache-Control' : 'no-store'
|
|
36
|
+ })
|
|
37
|
+
|
|
38
|
+ task.expire(() => {
|
|
39
|
+ done()
|
|
40
|
+ })
|
|
41
|
+
|
|
42
|
+ task.catch((err) => {
|
|
43
|
+ console.log(err)
|
|
44
|
+ })
|
|
45
|
+
|
|
46
|
+ task.then((res) => {
|
|
47
|
+ console.log('resp response received', res.data.length)
|
|
48
|
+ // done()
|
|
49
|
+ })
|
|
50
|
+
|
|
51
|
+})
|