Ei kuvausta

test-init.js 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. Dimensions,
  10. Platform,
  11. Dimension,
  12. Image,
  13. } from 'react-native';
  14. const { Assert, Comparer, Info, prop } = RNTest
  15. // test environment variables
  16. prop('FILENAME', `${Platform.OS}-0.10.0-${Date.now()}.png`)
  17. // prop('TEST_SERVER_URL', 'http://localhost:8123')
  18. // prop('TEST_SERVER_URL_SSL', 'https://localhost:8124')
  19. prop('TEST_SERVER_URL', 'http://192.168.17.185:8123')
  20. prop('TEST_SERVER_URL_SSL', 'https://192.168.17.185:8124')
  21. prop('DROPBOX_TOKEN', 'fsXcpmKPrHgAAAAAAAAAoXZhcXYWdgLpQMan6Tb_bzJ237DXhgQSev12hA-gUXt4')
  22. prop('styles', {
  23. image : {
  24. width: Dimensions.get('window').width*0.9,
  25. height : Dimensions.get('window').width*0.9,
  26. margin : 16,
  27. flex : 1
  28. }
  29. })
  30. const { TEST_SERVER_URL, FILENAME, DROPBOX_TOKEN, styles, image } = prop()
  31. const describe = RNTest.config({
  32. run : true,
  33. expand : true,
  34. timeout : 5000,
  35. })
  36. // init
  37. describe('GET image from server', (report, done) => {
  38. RNFetchBlob
  39. .fetch('GET', `${TEST_SERVER_URL}/public/github.png`, {
  40. Authorization : 'Bearer abde123eqweje'
  41. })
  42. .then((resp) => {
  43. RNTest.prop('image', resp.base64())
  44. report(
  45. <Info key="Response image">
  46. <Image
  47. style={styles.image}
  48. source={{uri : `data:image/png;base64, ${prop('image')}`}}/>
  49. </Info>)
  50. done()
  51. })
  52. })
  53. // require('./test-0.1.x-0.4.x')
  54. // require('./test-0.5.1')
  55. // require('./test-0.5.2')
  56. // require('./test-0.6.0')
  57. // require('./test-0.6.2')
  58. // require('./test-0.7.0')
  59. // require('./test-0.8.0')
  60. // require('./test-0.9.0')
  61. // require('./test-0.9.2')
  62. // require('./test-0.9.4')
  63. // require('./test-0.9.5')
  64. // require('./test-0.9.6')
  65. // require('./test-0.10.0')
  66. require('./test-0.10.1')
  67. // require('./test-background.js')
  68. // require('./test-stream')
  69. // require('./test-fetch')
  70. // require('./test-fs')
  71. // require('./test-xmlhttp')
  72. // require('./test-blob')
  73. // require('./test-firebase')
  74. // require('./test-android')
  75. // require('./test-stress')
  76. // require('./benchmark')