|
@@ -148,52 +148,52 @@ const dirs = RNFetchBlob.fs.dirs
|
148
|
148
|
// })
|
149
|
149
|
// })
|
150
|
150
|
//
|
151
|
|
-// #75
|
152
|
|
-describe('APK downloaded from Download Manager should correct', (report, done) => {
|
153
|
|
-
|
154
|
|
- let url = null
|
|
151
|
+// // #75
|
|
152
|
+// describe('APK downloaded from Download Manager should correct', (report, done) => {
|
|
153
|
+//
|
|
154
|
+// let url = null
|
|
155
|
+//
|
|
156
|
+// RNFetchBlob.config({
|
|
157
|
+// addAndroidDownloads : {
|
|
158
|
+// useDownloadManager : true,
|
|
159
|
+// title : 'test-APK',
|
|
160
|
+// description : 'apk install file',
|
|
161
|
+// mime : 'application/vnd.android.package-archive',
|
|
162
|
+// mediaScannable : true,
|
|
163
|
+// notification : true,
|
|
164
|
+// }
|
|
165
|
+// })
|
|
166
|
+// .fetch('GET', `${TEST_SERVER_URL}/public/apk-dummy.apk`)
|
|
167
|
+// .then((res) => {
|
|
168
|
+// let sendIntent = RNFetchBlob.android.actionViewIntent
|
|
169
|
+// return sendIntent(res.path(), 'application/vnd.android.package-archive')
|
|
170
|
+// })
|
|
171
|
+// .then(() => {
|
|
172
|
+// done()
|
|
173
|
+// })
|
|
174
|
+//
|
|
175
|
+// })
|
155
|
176
|
|
|
177
|
+// issue #74
|
|
178
|
+describe('download file to specific location using DownloadManager', (report, done) => {
|
|
179
|
+ let dest = dirs.DCIMDir + '/android-download-test-' +Date.now() + '.png'
|
156
|
180
|
RNFetchBlob.config({
|
157
|
181
|
addAndroidDownloads : {
|
158
|
182
|
useDownloadManager : true,
|
159
|
|
- title : 'test-APK',
|
160
|
|
- description : 'apk install file',
|
161
|
|
- mime : 'application/vnd.android.package-archive',
|
162
|
|
- mediaScannable : true,
|
163
|
|
- notification : true,
|
|
183
|
+ path : dest,
|
|
184
|
+ mime : 'image/png',
|
|
185
|
+ title : 'android-download-path-test.png',
|
|
186
|
+ description : 'download to specific path #74'
|
164
|
187
|
}
|
165
|
188
|
})
|
166
|
|
- .fetch('GET', `${TEST_SERVER_URL}/public/apk-dummy.apk`)
|
167
|
|
- .then((res) => {
|
168
|
|
- let sendIntent = RNFetchBlob.android.actionViewIntent
|
169
|
|
- return sendIntent(res.path(), 'application/vnd.android.package-archive')
|
170
|
|
- })
|
171
|
|
- .then(() => {
|
|
189
|
+ .fetch('GET', `${TEST_SERVER_URL}/public/github.png`)
|
|
190
|
+ .then((res) => fs.stat(res.path()))
|
|
191
|
+ .then((stat) => {
|
|
192
|
+ report(
|
|
193
|
+ <Assert key="file exists at the path"
|
|
194
|
+ expect={true} actual={true}/>,
|
|
195
|
+ <Assert key="file size correct"
|
|
196
|
+ expect="23975" actual={stat.size}/>)
|
172
|
197
|
done()
|
173
|
198
|
})
|
174
|
|
-
|
175
|
199
|
})
|
176
|
|
-
|
177
|
|
-// issue #74
|
178
|
|
-// describe('download file to specific location using DownloadManager', (report, done) => {
|
179
|
|
-// let dest = dirs.DCIMDir + '/android-download-test-' +Date.now() + '.png'
|
180
|
|
-// RNFetchBlob.config({
|
181
|
|
-// addAndroidDownloads : {
|
182
|
|
-// useDownloadManager : true,
|
183
|
|
-// path : dest,
|
184
|
|
-// mime : 'image/png',
|
185
|
|
-// title : 'android-download-path-test.png',
|
186
|
|
-// description : 'download to specific path #74'
|
187
|
|
-// }
|
188
|
|
-// })
|
189
|
|
-// .fetch('GET', `${TEST_SERVER_URL}/public/github.png`)
|
190
|
|
-// .then((res) => fs.stat(res.path()))
|
191
|
|
-// .then((stat) => {
|
192
|
|
-// report(
|
193
|
|
-// <Assert key="file exists at the path"
|
194
|
|
-// expect={true} actual={true}/>,
|
195
|
|
-// <Assert key="file size correct"
|
196
|
|
-// expect="23975" actual={stat.size}/>)
|
197
|
|
-// done()
|
198
|
|
-// })
|
199
|
|
-// })
|