Browse Source

Add file API test #18

Ben Hsieh 8 years ago
parent
commit
538d11d747
2 changed files with 39 additions and 19 deletions
  1. 0
    19
      test/test-0.5.x.js
  2. 39
    0
      test/test-fs.js

+ 0
- 19
test/test-0.5.x.js View File

@@ -23,25 +23,6 @@ let prefix = ((Platform.OS === 'android') ? 'file://' : '')
23 23
 
24 24
 // added after 0.5.0
25 25
 
26
-describe('Get storage folders', (report, done) => {
27
-
28
-  RNFetchBlob.getSystemDirs().then((dirs) => {
29
-    report(
30
-      <Assert key="system folders should exists" expect={dirs} comparer={Comparer.exists} />,
31
-      <Assert key="check properties"
32
-        expect={dirs}
33
-        comparer={Comparer.hasProperties}
34
-        actual={['PictureDir', 'MovieDir', 'DocumentDir', 'CacheDir', 'MusicDir', 'DCIMDir']}
35
-      />,
36
-      <Info key="System Folders">
37
-        <Text>{`${JSON.stringify(dirs)}`}</Text>
38
-      </Info>
39
-    )
40
-    done()
41
-  })
42
-
43
-})
44
-
45 26
 let tmpFilePath = null
46 27
 
47 28
 describe('Download file to storage with custom file extension', (report, done) => {

+ 39
- 0
test/test-fs.js View File

@@ -0,0 +1,39 @@
1
+import RNTest from './react-native-testkit/'
2
+import React from 'react'
3
+import RNFetchBlob from 'react-native-fetch-blob'
4
+
5
+import {
6
+  StyleSheet,
7
+  Text,
8
+  View,
9
+  ScrollView,
10
+  Dimensions,
11
+  Image,
12
+} from 'react-native';
13
+const { Assert, Comparer, Info, prop } = RNTest
14
+const describe = RNTest.config({
15
+  group : 'fs',
16
+  expand : false,
17
+  run : true
18
+})
19
+
20
+let { TEST_SERVER_URL, FILENAME, DROPBOX_TOKEN, styles, image } = prop()
21
+
22
+describe('Get storage folders', (report, done) => {
23
+
24
+  RNFetchBlob.getSystemDirs().then((dirs) => {
25
+    report(
26
+      <Assert key="system folders should exists" expect={dirs} comparer={Comparer.exists} />,
27
+      <Assert key="check properties"
28
+        expect={dirs}
29
+        comparer={Comparer.hasProperties}
30
+        actual={['DocumentDir', 'CacheDir', 'DCIMDir', 'DownloadDir']}
31
+      />,
32
+      <Info key="System Folders">
33
+        <Text>{`${JSON.stringify(dirs)}`}</Text>
34
+      </Info>
35
+    )
36
+    done()
37
+  })
38
+
39
+})