Browse Source

Add tests for #43

Ben Hsieh 8 years ago
parent
commit
e3a7280f84
5 changed files with 61 additions and 6 deletions
  1. 3
    0
      test/assets/test-asset1.json
  2. BIN
      test/assets/test-asset2.png
  3. 1
    0
      test/index.test.js
  4. 50
    0
      test/test-0.6.2.js
  5. 7
    6
      test/test-init.js

+ 3
- 0
test/assets/test-asset1.json View File

@@ -0,0 +1,3 @@
1
+{
2
+  "secret" : "asset#1"
3
+}

BIN
test/assets/test-asset2.png View File


+ 1
- 0
test/index.test.js View File

@@ -10,6 +10,7 @@ import {
10 10
   View,
11 11
   Platform,
12 12
   ScrollView,
13
+  CameraRoll,
13 14
   Image,
14 15
 } from 'react-native';
15 16
 

+ 50
- 0
test/test-0.6.2.js View File

@@ -0,0 +1,50 @@
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
+  CameraRoll,
11
+  Platform,
12
+  Dimensions,
13
+  Image,
14
+} from 'react-native';
15
+
16
+const fs = RNFetchBlob.fs
17
+const { Assert, Comparer, Info, prop } = RNTest
18
+const describe = RNTest.config({
19
+  group : '0.6.2',
20
+  run : true,
21
+  expand : true,
22
+  timeout : 12000,
23
+})
24
+const { TEST_SERVER_URL_SSL, FILENAME, DROPBOX_TOKEN, styles } = prop()
25
+const  dirs = RNFetchBlob.fs.dirs
26
+
27
+let prefix = ((Platform.OS === 'android') ? 'file://' : '')
28
+
29
+CameraRoll.getPhotos({first : 10}, function(resp){console.log(resp)}, (err)=>{console.log(err)})
30
+  // .then((resp) => {
31
+  //   console.log(resp)
32
+  // })
33
+  // .catch((err) => {
34
+  //   console.log(err)
35
+  // })
36
+
37
+describe('access file in assets', (report, done) => {
38
+  CameraRoll.getPhotos({first : 10})
39
+    .then((resp) => {
40
+      report(<Info key="items">
41
+        <Text>{JSON.stringify(resp)}</Text>
42
+      </Info>)
43
+    })
44
+    .catch((err) => {
45
+      console.log(err)
46
+      report(<Info key="err">
47
+        <Text>{JSON.stringify(err)}</Text>
48
+      </Info>)
49
+    })
50
+})

+ 7
- 6
test/test-init.js View File

@@ -51,9 +51,10 @@ describe('GET image from server', (report, done) => {
51 51
     })
52 52
 })
53 53
 //
54
-require('./test-0.1.x-0.4.x')
55
-require('./test-0.5.1')
56
-require('./test-0.5.2')
57
-require('./test-0.6.0')
58
-require('./test-fs')
59
-require('./test-android')
54
+// require('./test-0.1.x-0.4.x')
55
+// require('./test-0.5.1')
56
+// require('./test-0.5.2')
57
+// require('./test-0.6.0')
58
+require('./test-0.6.2')
59
+// require('./test-fs')
60
+// require('./test-android')