Browse Source

#8 Add media scanner test

Ben Hsieh 8 years ago
parent
commit
ca416b9972
2 changed files with 24 additions and 1 deletions
  1. 23
    0
      test/test-android.js
  2. 1
    1
      test/test-init.js

+ 23
- 0
test/test-android.js View File

55
   })
55
   })
56
 
56
 
57
 })
57
 })
58
+
59
+describe('MediaScanner tests ', (report, done) => {
60
+  let filePath = null
61
+  let filename = `scannable-test-${Date.now()}.png`
62
+  RNFetchBlob.fs.getSystemDirs().then((dirs) => {
63
+    filePath = `${dirs.DownloadDir}/${filename}`
64
+    return RNFetchBlob.config({
65
+        path : filePath,
66
+      })
67
+      .fetch('GET', `${TEST_SERVER_URL}/public/github2.jpg`)
68
+  })
69
+  .then((resp) => {
70
+    tmpFilePath = resp.path()
71
+    RNFetchBlob.fs.scanFile([
72
+      { path:resp.path() }
73
+    ])
74
+    .then(() => {
75
+      report(<Assert key="scan success" expect={true} actual={true}/>)
76
+      done()
77
+    })
78
+  })
79
+
80
+})

+ 1
- 1
test/test-init.js View File

51
     })
51
     })
52
 })
52
 })
53
 
53
 
54
-require('./test-fs')
54
+// require('./test-fs')
55
 // require('./test-0.1.x-0.4.x')
55
 // require('./test-0.1.x-0.4.x')
56
 // require('./test-0.5.x')
56
 // require('./test-0.5.x')
57
 require('./test-android')
57
 require('./test-android')