Browse Source

Add 0.10.0 test cases

Ben Hsieh 8 years ago
parent
commit
cedbf95aa2
4 changed files with 48348 additions and 51 deletions
  1. 48332
    0
      test-server/public/json-dummy.json
  2. 15
    5
      test/test-0.10.0.js
  3. 1
    2
      test/test-init.js
  4. 0
    44
      test/test-nedb.js

+ 48332
- 0
test-server/public/json-dummy.json
File diff suppressed because it is too large
View File


+ 15
- 5
test/test-0.10.0.js View File

@@ -10,8 +10,7 @@ import {
10 10
   Dimensions,
11 11
   Image,
12 12
 } from 'react-native';
13
-import DataStore from 'nedb'
14
-
13
+const JSONStream = RNFetchBlob.JSONStream
15 14
 const fs = RNFetchBlob.fs
16 15
 const { Assert, Comparer, Info, prop } = RNTest
17 16
 const describe = RNTest.config({
@@ -22,10 +21,21 @@ const describe = RNTest.config({
22 21
 })
23 22
 const { TEST_SERVER_URL, TEST_SERVER_URL_SSL, FILENAME, DROPBOX_TOKEN, styles } = prop()
24 23
 const dirs = RNFetchBlob.fs.dirs
25
-
26 24
 let prefix = ((Platform.OS === 'android') ? 'file://' : '')
27
-const db = new DataStore()
25
+let begin = Date.now()
26
+
27
+describe('oboe test', (report, done) => {
28 28
 
29
-describe('nedb constructor test', (report, done) =>{
29
+  let count = 0
30
+  JSONStream(`${TEST_SERVER_URL}/public/json-dummy.json`).node('name', (name) => {
31
+    count++
32
+    if(Date.now() - begin < 100)
33
+    return
34
+    begin = Date.now()
35
+    report(<Info key="report" uid="100">
36
+      <Text>{count} records</Text>
37
+    </Info>)
38
+    done()
39
+  })
30 40
 
31 41
 })

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

@@ -68,8 +68,7 @@ describe('GET image from server', (report, done) => {
68 68
 // require('./test-0.8.0')
69 69
 // require('./test-0.9.0')
70 70
 // require('./test-0.9.2')
71
-// require('./test-0.10.0')
72
-require('./test-nedb')
71
+require('./test-0.10.0')
73 72
 // require('./test-fetch')
74 73
 // require('./test-fs')
75 74
 // require('./test-xmlhttp')

+ 0
- 44
test/test-nedb.js View File

@@ -1,44 +0,0 @@
1
-import RNTest from './react-native-testkit/'
2
-import React from 'react'
3
-import RNFetchBlob from 'react-native-fetch-blob'
4
-import DataStore from 'nedb'
5
-import {
6
-  StyleSheet,
7
-  Text,
8
-  View,
9
-  ScrollView,
10
-  Platform,
11
-  Dimensions,
12
-  Image,
13
-} from 'react-native';
14
-
15
-const fs = RNFetchBlob.fs
16
-const { Assert, Comparer, Info, prop } = RNTest
17
-const describe = RNTest.config({
18
-  group : '0.10.0',
19
-  run : true,
20
-  expand : true,
21
-  timeout : 20000,
22
-})
23
-const { TEST_SERVER_URL, TEST_SERVER_URL_SSL, FILENAME, DROPBOX_TOKEN, styles } = prop()
24
-const dirs = RNFetchBlob.fs.dirs
25
-
26
-let prefix = ((Platform.OS === 'android') ? 'file://' : '')
27
-const DB_PATH = fs.dirs.DocumentDir + `/nedb/test-db-${Date.now()}.db`
28
-const db = null
29
-
30
-describe('nedb persistant constructor test', (report, done) =>{
31
-  db = new DataStore(DB_PATH)
32
-  // db.loadDatabase(function(err) {
33
-  //   report(<Assert key="database should created" expect={null} actual={err}/>)
34
-  //   done()
35
-  // })
36
-
37
-})
38
-
39
-describe('db CRUD test', (report, done) => {
40
-  let data = 'first record' + Date.now()
41
-  db.insert(data, (err, newDoc) => {
42
-    console.log(err, newDoc)
43
-  })
44
-})