|
@@ -117,15 +117,6 @@ describe('#118 ', (report, done) => {
|
117
|
117
|
cache = res.path()
|
118
|
118
|
return fs.readStream(cache, 'utf8', 102400)
|
119
|
119
|
})
|
120
|
|
- // .then((res) => {
|
121
|
|
- // cache = res.path()
|
122
|
|
- // return fs.readFile(cache, 'utf8')
|
123
|
|
- // })
|
124
|
|
- // .then(() => {
|
125
|
|
- // report(<Info key="good" />)
|
126
|
|
- // done()
|
127
|
|
- // fs.unlink(cache)
|
128
|
|
- // })
|
129
|
120
|
.then((stream) => {
|
130
|
121
|
stream.open()
|
131
|
122
|
start = Date.now()
|
|
@@ -153,3 +144,29 @@ describe('#118 ', (report, done) => {
|
153
|
144
|
})
|
154
|
145
|
|
155
|
146
|
})
|
|
147
|
+
|
|
148
|
+describe('issue #120 upload progress should work when sending body as-is', (report, done) => {
|
|
149
|
+
|
|
150
|
+ let data = RNTest.prop('image')
|
|
151
|
+ let tick = 0
|
|
152
|
+
|
|
153
|
+ let task = RNFetchBlob.fetch('POST', 'https://content.dropboxapi.com/2/files/upload', {
|
|
154
|
+ Authorization : `Bearer ${DROPBOX_TOKEN}`,
|
|
155
|
+ 'Dropbox-API-Arg': '{\"path\": \"/rn-upload/'+FILENAME+'\",\"mode\": \"add\",\"autorename\": true,\"mute\": false}',
|
|
156
|
+ 'Content-Type' : 'text/plain; charset=dropbox-cors-hack',
|
|
157
|
+ }, data)
|
|
158
|
+
|
|
159
|
+ task.uploadProgress((current, total) => {
|
|
160
|
+ tick ++
|
|
161
|
+ })
|
|
162
|
+ .then((res) => {
|
|
163
|
+ let resp = res.json()
|
|
164
|
+ report(
|
|
165
|
+ <Info key="viewer"><Text>{JSON.stringify(resp)}</Text></Info>,
|
|
166
|
+ <Assert key="event should be triggered"
|
|
167
|
+ expect={tick}
|
|
168
|
+ comparer={Comparer.greater} actual={0}/>)
|
|
169
|
+ done()
|
|
170
|
+ })
|
|
171
|
+
|
|
172
|
+})
|