瀏覽代碼

Add test case for #225

Ben Hsieh 8 年之前
父節點
當前提交
48c786c026
共有 1 個文件被更改,包括 20 次插入0 次删除
  1. 20
    0
      test/test-init.js

+ 20
- 0
test/test-init.js 查看文件

@@ -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