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

Commit f46ecf8

Browse files
committed
Add test files and test case
1 parent 9daa07f commit f46ecf8

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

test-server/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ public/*
44
!public/github2.jpg
55
!public/22mb-dummy
66
!public/1mb-dummy
7+
!public/beethoven.mp3
8+
!public/cat-fu.mp4
79
!uploads/readme

test-server/public/beethoven.mp3

3.24 MB
Binary file not shown.

test-server/public/cat-fu.mp4

12.1 MB
Binary file not shown.

test/test-android.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ describe('Download with notification', (report, done) => {
5959
describe('MediaScanner tests ', (report, done) => {
6060
let filePath = null
6161
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
6365
filePath = `${dirs.DownloadDir}/${filename}`
6466
return RNFetchBlob.config({
6567
path : filePath,
@@ -68,11 +70,24 @@ describe('MediaScanner tests ', (report, done) => {
6870
})
6971
.then((resp) => {
7072
tmpFilePath = resp.path()
71-
RNFetchBlob.fs.scanFile([
73+
return RNFetchBlob.fs.scanFile([
7274
{ path:resp.path() }
7375
])
7476
.then(() => {
7577
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}/>)
7691
done()
7792
})
7893
})

0 commit comments

Comments
 (0)