Browse Source

add test case

Ben Hsieh 8 years ago
parent
commit
da5673a9cc
1 changed files with 26 additions and 26 deletions
  1. 26
    26
      test/test-0.9.5.js

+ 26
- 26
test/test-0.9.5.js View File

@@ -53,33 +53,33 @@ let prefix = ((Platform.OS === 'android') ? 'file://' : '')
53 53
 //
54 54
 // })
55 55
 
56
-// describe('#129 memory leaking when enable uploadProgress', (report, done) => {
57
-//
58
-//   let file = null
59
-//   let count = 0
60
-//
61
-//   RNFetchBlob.config({ fileCache : true })
62
-//     .fetch('GET', `${TEST_SERVER_URL}/public/6mb-dummy`)
63
-//     .then((res) => {
64
-//       file = res.path()
65
-//       setTimeout(() => {
66
-//         for(let i=0;i<20;i++){
67
-//           RNFetchBlob.fetch('POST', `${TEST_SERVER_URL}/upload`, {}, RNFetchBlob.wrap(file))
68
-//           .uploadProgress(() => {})
69
-//           .then(() => {
70
-//             if(count > 20) {
71
-//               fs.unlink(file)
72
-//               report(<Assert key="finished" expect={true} actual={true}/>)
73
-//               done()
74
-//             }
75
-//           })
76
-//         }
77
-//       }, 3000)
78
-//     })
79
-//
80
-// })
56
+describe('#129 memory leaking when enable uploadProgress', (report, done) => {
57
+
58
+  let file = null
59
+  let count = 0
60
+
61
+  RNFetchBlob.config({ fileCache : true })
62
+    .fetch('GET', `${TEST_SERVER_URL}/public/6mb-dummy`)
63
+    .then((res) => {
64
+      file = res.path()
65
+      for(let i=0;i<10;i++){
66
+        RNFetchBlob.fetch('POST', `${TEST_SERVER_URL}/upload`, {
67
+          'Transfer-Encoding' : 'Chunked'
68
+        }, RNFetchBlob.wrap(file))
69
+        .uploadProgress((current, total) => {})
70
+        .then(() => {
71
+          count ++
72
+          if(count >= 10) {
73
+            fs.unlink(file)
74
+            done()
75
+          }
76
+        })
77
+      }
78
+    })
79
+
80
+})
81 81
 
82
-describe('#131 status code != 200 should not throw an error', (report, done) => {
82
+false && describe('#131 status code != 200 should not throw an error', (report, done) => {
83 83
 
84 84
   let count = 0
85 85
   let codes = [404, 500, 501, 403]