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

Commit 849d240

Browse files
committed
Add test cases for #75
1 parent bb76484 commit 849d240

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

test/test-android.js

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ describe('android download manager', (report, done) => {
106106
report(
107107
<Assert key="download manager complete handler" expect={true} actual={true}/>
108108
)
109-
console.log('woo',resp)
110109
return resp.readStream('ascii')
111110
})
112111
.then((stream) => {
@@ -126,3 +125,51 @@ describe('android download manager', (report, done) => {
126125
})
127126
})
128127
})
128+
129+
describe('open a file from intent', (report, done) => {
130+
let url = null
131+
RNFetchBlob.config({
132+
addAndroidDownloads : {
133+
useDownloadManager : true,
134+
title : 'test-image',
135+
description : 'open it from intent !',
136+
mime : 'image/png',
137+
mediaScannable : true,
138+
notification : true,
139+
}
140+
})
141+
.fetch('GET', `${TEST_SERVER_URL}/public/github.png`)
142+
.then((res) => {
143+
let sendIntent = RNFetchBlob.android.actionViewIntent
144+
return sendIntent(res.path(), 'image/png')
145+
})
146+
.then(() => {
147+
done()
148+
})
149+
})
150+
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+
})

0 commit comments

Comments
 (0)