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

Commit d2a1b79

Browse files
committed
Add test cases for progress report API #1 #8
1 parent eb70391 commit d2a1b79

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/tests.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,22 @@ ctx.describe('Compare uploaded multipart image', async function(report) {
9999

100100
})
101101

102+
ctx.describe('Progress report test', (report) => new Promise((resolve) => {
103+
104+
let p1 = RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/github.png`, {
105+
Authorization : 'Bearer abde123eqweje'
106+
})
107+
let log = []
108+
109+
p1.onProgress = (written, total) => {
110+
log.push(<Info key={`progress = ${written} bytes / ${total} bytes`}></Info>)
111+
if(written === total)
112+
log.push(<Assert key="progress goes to 100%" expect={written} actual={total}/>)
113+
report(...log)
114+
resolve()
115+
}
116+
117+
}))
118+
102119

103120
export default ctx

0 commit comments

Comments
 (0)