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

Commit c8d178a

Browse files
committed
Add #99 test cases
1 parent a81b5f1 commit c8d178a

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

test/test-0.10.0.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
Text,
77
View,
88
ScrollView,
9+
Linking,
910
Platform,
1011
Dimensions,
1112
Image,
@@ -24,7 +25,7 @@ const dirs = RNFetchBlob.fs.dirs
2425
let prefix = ((Platform.OS === 'android') ? 'file://' : '')
2526
let begin = Date.now()
2627

27-
describe('oboe test', (report, done) => {
28+
describe('json stream via HTTP', (report, done) => {
2829

2930
let count = 0
3031
JSONStream(`${TEST_SERVER_URL}/public/json-dummy.json`).node('name', (name) => {
@@ -39,3 +40,34 @@ describe('oboe test', (report, done) => {
3940
})
4041

4142
})
43+
44+
describe('json stream via fs', (report, done) => {
45+
46+
let fetch2 = new RNFetchBlob.polyfill.Fetch({
47+
auto : true
48+
})
49+
let res = null
50+
let count = 0
51+
52+
RNFetchBlob.config({
53+
fileCache : true
54+
})
55+
.fetch('GET',`${TEST_SERVER_URL}/public/json-dummy.json`)
56+
.then((resp) => {
57+
res = resp
58+
JSONStream({
59+
url : RNFetchBlob.wrap(res.path()),
60+
headers : { bufferSize : 10240 }
61+
}).node('name', (name) => {
62+
count++
63+
if(Date.now() - begin < 100)
64+
return
65+
begin = Date.now()
66+
report(<Info key="report" uid="100">
67+
<Text>{count} records</Text>
68+
</Info>)
69+
done()
70+
})
71+
})
72+
73+
})

0 commit comments

Comments
 (0)