Bez popisu

test-nedb.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. const fs = RNFetchBlob.fs
  15. const { Assert, Comparer, Info, prop } = RNTest
  16. const describe = RNTest.config({
  17. group : '0.10.0',
  18. run : true,
  19. expand : true,
  20. timeout : 20000,
  21. })
  22. const { TEST_SERVER_URL, TEST_SERVER_URL_SSL, FILENAME, DROPBOX_TOKEN, styles } = prop()
  23. const dirs = RNFetchBlob.fs.dirs
  24. let prefix = ((Platform.OS === 'android') ? 'file://' : '')
  25. const DB_PATH = fs.dirs.DocumentDir + `/nedb/test-db-${Date.now()}.db`
  26. const db = null
  27. describe('nedb persistant constructor test', (report, done) =>{
  28. db = new DataStore(DB_PATH)
  29. // db.loadDatabase(function(err) {
  30. // report(<Assert key="database should created" expect={null} actual={err}/>)
  31. // done()
  32. // })
  33. })
  34. describe('db CRUD test', (report, done) => {
  35. let data = 'first record' + Date.now()
  36. db.insert(data, (err, newDoc) => {
  37. console.log(err, newDoc)
  38. })
  39. })