Browse Source

Change test app scripts

Ben Hsieh 8 years ago
parent
commit
5a83b89162
2 changed files with 33 additions and 7 deletions
  1. 8
    0
      src/.flowconfig
  2. 25
    7
      test/tests.js

+ 8
- 0
src/.flowconfig View File

@@ -0,0 +1,8 @@
1
+[ignore]
2
+
3
+[include]
4
+
5
+
6
+[libs]
7
+
8
+[options]

+ 25
- 7
test/tests.js View File

@@ -13,7 +13,7 @@ import {
13 13
   Image,
14 14
 } from 'react-native';
15 15
 
16
-const FILENAME = `${Platform.OS}-0.4.2-${Date.now()}.png`
16
+const FILENAME = `${Platform.OS}-0.5.0-${Date.now()}.png`
17 17
 // paste your test config here
18 18
 const TEST_SERVER_URL = 'http://192.168.17.193:8123'
19 19
 const DROPBOX_TOKEN = 'fsXcpmKPrHgAAAAAAAAAoXZhcXYWdgLpQMan6Tb_bzJ237DXhgQSev12hA-gUXt4'
@@ -99,16 +99,18 @@ ctx.describe('Compare uploaded multipart image', async function(report) {
99 99
 
100 100
 })
101 101
 
102
+// added after 0.4.2
103
+
102 104
 ctx.describe('Progress report test', (report) => new Promise((resolve) => {
103 105
   let received = 0
104
-  let p1 = RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/22mb-dummy`, {
106
+  let p1 = RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/1mb-dummy`, {
105 107
       Authorization : 'Bearer abde123eqweje'
106 108
     })
107
-    // .progress((written, total) => {
108
-    //   // report(<Info key={`progress = ${written} bytes / ${total} bytes`}/>)
109
-    //   if(written === total)
110
-    //     report(<Assert key="progress goes to 100%" expect={written} actual={total}/>)
111
-    // })
109
+    .progress((written, total) => {
110
+      report(<Info key={`progress = ${written} bytes / ${total} bytes`}/>)
111
+      if(written === total)
112
+        report(<Assert key="progress goes to 100%" expect={written} actual={total}/>)
113
+    })
112 114
     .then((resp) => {
113 115
       report(<Assert key="response data should be correct event with progress listener"
114 116
         expect={resp.text().substr(0,10)} actual={"1234567890"}/>)
@@ -117,5 +119,21 @@ ctx.describe('Progress report test', (report) => new Promise((resolve) => {
117 119
 
118 120
 }))
119 121
 
122
+// FIXME : not yet supported
123
+ctx.describe('Large file download test', (report) => new Promise((resolve) => {
124
+  let received = 0
125
+  let p1 = RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/22mb-dummy`, {
126
+      Authorization : 'Bearer abde123eqweje'
127
+    })
128
+    .then((resp) => {
129
+      report(<Assert key="not supported"
130
+        expect={true} actual={false}/>)
131
+      resolve()
132
+    })
133
+
134
+}))
135
+
136
+// added after 0.5.0
137
+
120 138
 
121 139
 export default ctx