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

Commit 212822b

Browse files
committed
Add test case
1 parent 1720e2b commit 212822b

File tree

4 files changed

+38
-2
lines changed

4 files changed

+38
-2
lines changed
File renamed without changes.
File renamed without changes.

test/test-0.5.x.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,42 @@ describe('Upload multipart data with file from storage', (report, done) => {
146146
})
147147
})
148148

149+
describe('Upload and download at the same time', (report, done) => {
150+
151+
let content = 'POST and PUT calls with headers and body should also work correctly'
152+
let filename = 'download-header-test-' + Date.now()
153+
let body = RNFetchBlob.base64.encode(content)
154+
155+
RNFetchBlob
156+
.config({
157+
fileCache : true,
158+
})
159+
.fetch('POST', 'https://content.dropboxapi.com/2/files/upload', {
160+
Authorization : `Bearer ${DROPBOX_TOKEN}`,
161+
'Dropbox-API-Arg': '{\"path\": \"/rn-upload/'+filename+'\",\"mode\": \"add\",\"autorename\": true,\"mute\": false}',
162+
'Content-Type' : 'application/octet-stream',
163+
}, body)
164+
.then((resp) => {
165+
return RNFetchBlob.fs.readStream(resp.path(), 'utf8')
166+
})
167+
.then((stream) => {
168+
let actual = ''
169+
stream.open()
170+
stream.onData((chunk) => {
171+
actual += chunk
172+
})
173+
stream.onEnd(() => {
174+
report(
175+
<Assert
176+
key="response data should be the filename"
177+
expect={filename}
178+
actual={JSON.parse(actual).name} />)
179+
done()
180+
})
181+
})
182+
183+
})
184+
149185
describe('Session create mechanism test', (report, done) => {
150186
let sessionName = 'foo-' + Date.now()
151187
testSessionName = sessionName

test/test-init.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('GET image from server', (report, done) => {
5151
})
5252

5353

54-
require('./test-fs')
5554
require('./test-0.1.x-0.4.x')
5655
require('./test-0.5.x')
57-
require('./test-android')
56+
// require('./test-fs')
57+
// require('./test-android')

0 commit comments

Comments
 (0)