Ben Hsieh 8 лет назад
Родитель
Сommit
48c786c026
1 измененных файлов: 20 добавлений и 0 удалений
  1. 20
    0
      test/test-init.js

+ 20
- 0
test/test-init.js Просмотреть файл

42
 
42
 
43
 // init
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
 describe('GET image from server', (report, done) => {
65
 describe('GET image from server', (report, done) => {
46
 
66
 
47
   RNFetchBlob
67
   RNFetchBlob