|
@@ -52,8 +52,6 @@ ctx.describe('GET image from server', (report, done) => {
|
52
|
52
|
|
53
|
53
|
})
|
54
|
54
|
|
55
|
|
-// FIXME : discard these test cases in feature branch
|
56
|
|
-//
|
57
|
55
|
// ctx.describe('The check if it follows 301/302 redirection', (report, done) => {
|
58
|
56
|
//
|
59
|
57
|
// RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/redirect`)
|
|
@@ -109,7 +107,7 @@ ctx.describe('GET image from server', (report, done) => {
|
109
|
107
|
//
|
110
|
108
|
//
|
111
|
109
|
// })
|
112
|
|
-
|
|
110
|
+//
|
113
|
111
|
// ctx.describe('Compare uploaded multipart image', (report, done) => {
|
114
|
112
|
// let r1 = null
|
115
|
113
|
// RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/test-img.png`)
|
|
@@ -129,37 +127,37 @@ ctx.describe('GET image from server', (report, done) => {
|
129
|
127
|
|
130
|
128
|
// added after 0.4.2
|
131
|
129
|
|
132
|
|
-ctx.describe('Progress report test', (report, done) => {
|
133
|
|
- let received = 0
|
134
|
|
- RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/1mb-dummy`, {
|
135
|
|
- Authorization : 'Bearer abde123eqweje'
|
136
|
|
- })
|
137
|
|
- .progress((written, total) => {
|
138
|
|
- report(<Info key={`progress = ${written} bytes / ${total} bytes`}/>)
|
139
|
|
- if(written === total)
|
140
|
|
- report(<Assert key="progress goes to 100%" expect={written} actual={total}/>)
|
141
|
|
- })
|
142
|
|
- .then((resp) => {
|
143
|
|
- report(<Assert key="response data should be correct event with progress listener"
|
144
|
|
- expect={resp.text().substr(0,10)} actual={"1234567890"}/>)
|
145
|
|
- done()
|
146
|
|
- })
|
147
|
|
-
|
148
|
|
-})
|
149
|
|
-
|
150
|
|
-// FIXME : not yet supported
|
151
|
|
-// ctx.describe('Large file download test', (report, done) => {
|
|
130
|
+// ctx.describe('Progress report test', (report, done) => {
|
152
|
131
|
// let received = 0
|
153
|
|
-// // RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/22mb-dummy`, {
|
154
|
|
-// // Authorization : 'Bearer abde123eqweje'
|
155
|
|
-// // })
|
156
|
|
-// // .then((resp) => {
|
157
|
|
-// report(<Assert key="not supported" expect={true} actual={false}/>)
|
158
|
|
-// done()
|
159
|
|
-// // })
|
|
132
|
+// RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/1mb-dummy`, {
|
|
133
|
+// Authorization : 'Bearer abde123eqweje'
|
|
134
|
+// })
|
|
135
|
+// .progress((written, total) => {
|
|
136
|
+// report(<Info key={`progress = ${written} bytes / ${total} bytes`}/>)
|
|
137
|
+// if(written === total)
|
|
138
|
+// report(<Assert key="progress goes to 100%" expect={written} actual={total}/>)
|
|
139
|
+// })
|
|
140
|
+// .then((resp) => {
|
|
141
|
+// report(<Assert key="response data should be correct event with progress listener"
|
|
142
|
+// expect={resp.text().substr(0,10)} actual={"1234567890"}/>)
|
|
143
|
+// done()
|
|
144
|
+// })
|
160
|
145
|
//
|
161
|
146
|
// })
|
162
|
147
|
|
|
148
|
+// FIXME : not yet supported
|
|
149
|
+ctx.describe('Large file download test', (report, done) => {
|
|
150
|
+ let received = 0
|
|
151
|
+ // RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/22mb-dummy`, {
|
|
152
|
+ // Authorization : 'Bearer abde123eqweje'
|
|
153
|
+ // })
|
|
154
|
+ // .then((resp) => {
|
|
155
|
+ report(<Assert key="not supported" expect={true} actual={false}/>)
|
|
156
|
+ done()
|
|
157
|
+ // })
|
|
158
|
+
|
|
159
|
+})
|
|
160
|
+
|
163
|
161
|
// added after 0.5.0
|
164
|
162
|
|
165
|
163
|
ctx.describe('Get storage folders', (report, done) => {
|
|
@@ -199,7 +197,7 @@ ctx.describe('Download file to storage with custom file extension', (report, don
|
199
|
197
|
})
|
200
|
198
|
})
|
201
|
199
|
|
202
|
|
-ctx.describe('Read cache file with file stream', (report, done) => {
|
|
200
|
+ctx.describe('Read cached file via file stream', (report, done) => {
|
203
|
201
|
let data = 'data:image/png;base64, '
|
204
|
202
|
let stream = RNFetchBlob.openReadStream(tmpFilePath, 'base64')
|
205
|
203
|
stream.onData((chunk) => {
|
|
@@ -219,4 +217,19 @@ ctx.describe('Read cache file with file stream', (report, done) => {
|
219
|
217
|
|
220
|
218
|
})
|
221
|
219
|
|
|
220
|
+ctx.describe('File stream reader error should be able to handled', (report, done) => {
|
|
221
|
+
|
|
222
|
+ let stream = RNFetchBlob.openReadStream('^_^ not exists', 'base64')
|
|
223
|
+ stream.onError((err) => {
|
|
224
|
+ report(<Info key="error message">
|
|
225
|
+ <Text>
|
|
226
|
+ {err}
|
|
227
|
+ </Text>
|
|
228
|
+ </Info>)
|
|
229
|
+ done()
|
|
230
|
+
|
|
231
|
+ })
|
|
232
|
+
|
|
233
|
+})
|
|
234
|
+
|
222
|
235
|
export default ctx
|