Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit 54c5584

Browse files
committed
Add test case for #47 #45
1 parent 972698e commit 54c5584

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

test/test-0.5.1.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -213,25 +213,27 @@ RNTest.config({
213213
})
214214
.then((res) => {
215215
deb = Date.now()
216-
return RNFetchBlob.fetch('POST', 'https://content.dropboxapi.com/2/files/upload', {
216+
let promise = RNFetchBlob.fetch('POST', 'https://content.dropboxapi.com/2/files/upload', {
217217
Authorization : `Bearer ${DROPBOX_TOKEN}`,
218218
'Dropbox-API-Arg': '{\"path\": \"/rn-upload/'+filename+'\",\"mode\": \"add\",\"autorename\": true,\"mute\": false}',
219219
'Content-Type' : 'application/octet-stream',
220220
}, RNFetchBlob.wrap(res.path()))
221-
.progress((now, total) => {
222-
if(Date.now() - deb < 1000)
223-
return
224-
deb = Date.now()
225-
if(begin2 === -1)
226-
begin2 = Date.now()
227-
let speed = Math.floor(now / (Date.now() - begin2))
228-
report(<Info uid="100" key="progress">
229-
<Text>
230-
{`upload ${now} / ${total} bytes (${speed} kb/s)`}
231-
{` ${Math.floor((total-now)/speed/1000)} seconds left`}
232-
</Text>
233-
</Info>)
234-
})
221+
if(Platform.OS === 'ios')
222+
promise.progress((now, total) => {
223+
if(Date.now() - deb < 1000)
224+
return
225+
deb = Date.now()
226+
if(begin2 === -1)
227+
begin2 = Date.now()
228+
let speed = Math.floor(now / (Date.now() - begin2))
229+
report(<Info uid="100" key="progress">
230+
<Text>
231+
{`upload ${now} / ${total} bytes (${speed} kb/s)`}
232+
{` ${Math.floor((total-now)/speed/1000)} seconds left`}
233+
</Text>
234+
</Info>)
235+
})
236+
return promise
235237
})
236238
.then((res) => {
237239
report(<Assert

0 commit comments

Comments
 (0)