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

Commit 3a3a1fa

Browse files
committed
Add #74 test case
1 parent b84c9fd commit 3a3a1fa

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/test-android.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,27 @@ describe('android download manager', (report, done) => {
126126
})
127127
})
128128
})
129+
130+
// issue #74
131+
describe('download file to specific location using DownloadManager', (report, done) => {
132+
let dest = dirs.DCIMDir + '/android-download-test-' +Date.now() + '.png'
133+
RNFetchBlob.config({
134+
addAndroidDownloads : {
135+
useDownloadManager : true,
136+
path : dest,
137+
mime : 'image/png',
138+
title : 'android-download-path-test.png',
139+
description : 'download to specific path #74'
140+
}
141+
})
142+
.fetch('GET', `${TEST_SERVER_URL}/public/github.png`)
143+
.then((res) => fs.stat(res.path()))
144+
.then((stat) => {
145+
report(
146+
<Assert key="file exists at the path"
147+
expect={true} actual={true}/>,
148+
<Assert key="file size correct"
149+
expect="23975" actual={stat.size}/>)
150+
done()
151+
})
152+
})

0 commit comments

Comments
 (0)