|
@@ -126,3 +126,27 @@ describe('android download manager', (report, done) => {
|
126
|
126
|
})
|
127
|
127
|
})
|
128
|
128
|
})
|
|
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
|
+})
|