|
@@ -113,3 +113,39 @@ describe('#263 parallel request', (report, done) => {
|
113
|
113
|
})
|
114
|
114
|
|
115
|
115
|
})
|
|
116
|
+
|
|
117
|
+describe('#264 network exceptions should be catachable', (report, done) => {
|
|
118
|
+
|
|
119
|
+ let task = RNFetchBlob
|
|
120
|
+ .config({ fileCache : true})
|
|
121
|
+ .fetch('GET',`${TEST_SERVER_URL}/interrupt`)
|
|
122
|
+ task
|
|
123
|
+ .then((res) => {
|
|
124
|
+ console.log(res.data)
|
|
125
|
+ console.log(res.info())
|
|
126
|
+ })
|
|
127
|
+ .catch((err) => {
|
|
128
|
+ console.log('##err',err)
|
|
129
|
+ })
|
|
130
|
+
|
|
131
|
+})
|
|
132
|
+
|
|
133
|
+describe('readstream with empty buffer', (report, done) => {
|
|
134
|
+
|
|
135
|
+ let data = { cool : 100 }
|
|
136
|
+ let path = dirs.DocumentDir + '/test' + Date.now()
|
|
137
|
+ let result = ''
|
|
138
|
+
|
|
139
|
+ fs.writeFile(path, JSON.stringify(data), 'utf8')
|
|
140
|
+ .then(() => fs.readStream(path, 'utf8'))
|
|
141
|
+ .then((stream) => {
|
|
142
|
+ stream.open()
|
|
143
|
+ stream.onData((chunk) => { result += chunk })
|
|
144
|
+ stream.onError((err) => console.log('err' + err))
|
|
145
|
+ stream.onEnd(() => {
|
|
146
|
+ console.log(result)
|
|
147
|
+ console.log(JSON.parse(result))
|
|
148
|
+ })
|
|
149
|
+ })
|
|
150
|
+
|
|
151
|
+})
|