No Description

test-0.10.2.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import RNTest from './react-native-testkit/'
  2. import React from 'react'
  3. import RNFetchBlob from 'react-native-fetch-blob'
  4. import {
  5. StyleSheet,
  6. Text,
  7. View,
  8. ScrollView,
  9. Linking,
  10. Platform,
  11. Dimensions,
  12. BackAndroid,
  13. AsyncStorage,
  14. Image,
  15. } from 'react-native';
  16. window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest
  17. window.Blob = RNFetchBlob.polyfill.Blob
  18. const JSONStream = RNFetchBlob.JSONStream
  19. const fs = RNFetchBlob.fs
  20. const { Assert, Comparer, Info, prop } = RNTest
  21. const describe = RNTest.config({
  22. group : '0.10.1',
  23. run : true,
  24. expand : true,
  25. timeout : 20000,
  26. })
  27. const { TEST_SERVER_URL, TEST_SERVER_URL_SSL, FILENAME, DROPBOX_TOKEN, styles } = prop()
  28. const dirs = RNFetchBlob.fs.dirs
  29. let prefix = ((Platform.OS === 'android') ? 'file://' : '')
  30. let begin = Date.now()
  31. describe('#227 IOS file modification date correctness', (report, done) => {
  32. let path = dirs.DocumentDir + '/issue-223-' + Date.now()
  33. fs.createFile(path, 'datafornow')
  34. .then(() => fs.stat(path))
  35. .then((stat) => {
  36. let date = stat.lastModified;
  37. console.log(date, stat);
  38. let correct = date/Date.now() > 0.95 || date/Date.now() < 1.05;
  39. report(<Assert key="modification date should be correct"
  40. expect={true} actual={correct}/>);
  41. done();
  42. })
  43. })