|
@@ -59,7 +59,9 @@ describe('Download with notification', (report, done) => {
|
59
|
59
|
describe('MediaScanner tests ', (report, done) => {
|
60
|
60
|
let filePath = null
|
61
|
61
|
let filename = `scannable-test-${Date.now()}.png`
|
62
|
|
- RNFetchBlob.fs.getSystemDirs().then((dirs) => {
|
|
62
|
+ let dirs = null
|
|
63
|
+ RNFetchBlob.fs.getSystemDirs().then((resp) => {
|
|
64
|
+ dirs = resp
|
63
|
65
|
filePath = `${dirs.DownloadDir}/${filename}`
|
64
|
66
|
return RNFetchBlob.config({
|
65
|
67
|
path : filePath,
|
|
@@ -68,11 +70,24 @@ describe('MediaScanner tests ', (report, done) => {
|
68
|
70
|
})
|
69
|
71
|
.then((resp) => {
|
70
|
72
|
tmpFilePath = resp.path()
|
71
|
|
- RNFetchBlob.fs.scanFile([
|
|
73
|
+ return RNFetchBlob.fs.scanFile([
|
72
|
74
|
{ path:resp.path() }
|
73
|
75
|
])
|
74
|
76
|
.then(() => {
|
75
|
77
|
report(<Assert key="scan success" expect={true} actual={true}/>)
|
|
78
|
+ return RNFetchBlob
|
|
79
|
+ .config({
|
|
80
|
+ path : dirs.DCIMDir + '/beethoven-'+ Date.now() +'.mp3'
|
|
81
|
+ })
|
|
82
|
+ .fetch('GET', `${TEST_SERVER_URL}/public/beethoven.mp3`)
|
|
83
|
+ })
|
|
84
|
+ })
|
|
85
|
+ .then((resp) => {
|
|
86
|
+ fs.scanFile([{
|
|
87
|
+ path : resp.path()
|
|
88
|
+ }])
|
|
89
|
+ .then(() => {
|
|
90
|
+ report(<Assert key="scan mp3 file success" expect={true} actual={true}/>)
|
76
|
91
|
done()
|
77
|
92
|
})
|
78
|
93
|
})
|