|
@@ -96,12 +96,32 @@ describe('android download manager', (report, done) => {
|
96
|
96
|
RNFetchBlob.config({
|
97
|
97
|
addAndroidDownloads : {
|
98
|
98
|
useDownloadManager : true,
|
99
|
|
- title : 'RNFetchBlob test download success',
|
|
99
|
+ title : 'RNFetchBlob test download manager test',
|
100
|
100
|
description : `File description added by RNFetchblob`,
|
101
|
101
|
mediaScannable : true,
|
102
|
|
- mime : "image/png",
|
103
|
102
|
notification : true
|
104
|
103
|
}
|
105
|
104
|
})
|
106
|
|
- .fetch('GET', `${TEST_SERVER_URL}/public/beethoven.mp3`)
|
|
105
|
+ .fetch('GET', `${TEST_SERVER_URL}/public/beethoven.mp3`).then((resp) => {
|
|
106
|
+ report(
|
|
107
|
+ <Assert key="download manager complete handler" expect={true} actual={true}/>
|
|
108
|
+ )
|
|
109
|
+ return resp.readStream('ascii')
|
|
110
|
+ })
|
|
111
|
+ .then((stream) => {
|
|
112
|
+ stream.open();
|
|
113
|
+ let len = 0
|
|
114
|
+ stream.onData((chunk) => {
|
|
115
|
+ len += chunk.length
|
|
116
|
+ })
|
|
117
|
+ stream.onEnd(() => {
|
|
118
|
+ report(
|
|
119
|
+ <Assert key="download manager URI is readable"
|
|
120
|
+ expect={len}
|
|
121
|
+ comparer={Comparer.greater}
|
|
122
|
+ actual={0}/>
|
|
123
|
+ )
|
|
124
|
+ done()
|
|
125
|
+ })
|
|
126
|
+ })
|
107
|
127
|
})
|