Browse Source

Add test case for #225

Ben Hsieh 7 years ago
parent
commit
48c786c026
1 changed files with 20 additions and 0 deletions
  1. 20
    0
      test/test-init.js

+ 20
- 0
test/test-init.js View File

@@ -42,6 +42,26 @@ const describe = RNTest.config({
42 42
 
43 43
 // init
44 44
 
45
+describe('#225 upload progress should fire correctly', (report, done) => {
46
+
47
+  let data = '';
48
+  let fired = false;
49
+  for(let i =0; i< 100000; i++) {
50
+    data += 'chunkchunk'
51
+  }
52
+  let upload = RNFetchBlob.fetch('POST', `${TEST_SERVER_URL}/upload`, {
53
+    'Content-Type' : 'text/plain;BASE64'
54
+  }, data)
55
+  upload.uploadProgress((total, now) => {
56
+    console.log(total, now)
57
+    fired = true;
58
+  })
59
+  upload.then(() => {
60
+    report(<Assert key="progress event fired" expect={true} actual={fired}/>);
61
+    done()
62
+  })
63
+})
64
+
45 65
 describe('GET image from server', (report, done) => {
46 66
 
47 67
   RNFetchBlob