Nessuna descrizione

test-init.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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, describe, prop } = RNTest
  15. // test environment variables
  16. prop('FILENAME', `${Platform.OS}-0.6.0-${Date.now()}.png`)
  17. prop('TEST_SERVER_URL', 'http://localhost:8123')
  18. prop('DROPBOX_TOKEN', 'fsXcpmKPrHgAAAAAAAAAoXZhcXYWdgLpQMan6Tb_bzJ237DXhgQSev12hA-gUXt4')
  19. prop('styles', {
  20. image : {
  21. width: Dimensions.get('window').width*0.9,
  22. height : Dimensions.get('window').width*0.9,
  23. margin :16
  24. }
  25. })
  26. const { TEST_SERVER_URL, FILENAME, DROPBOX_TOKEN, styles, image } = prop()
  27. // init
  28. describe('GET image from server', (report, done) => {
  29. RNFetchBlob
  30. .fetch('GET', `${TEST_SERVER_URL}/public/github.png`, {
  31. Authorization : 'Bearer abde123eqweje'
  32. })
  33. .then((resp) => {
  34. RNTest.prop('image', resp.base64())
  35. report(
  36. <Info key="Response image">
  37. <Image
  38. style={styles.image}
  39. source={{uri : `data:image/png;base64, ${prop('image')}`}}/>
  40. </Info>)
  41. done()
  42. })
  43. })
  44. // require('./test-0.1.x-0.4.x')
  45. // require('./test-0.5.1')
  46. // require('./test-0.5.2')
  47. // require('./test-fs')
  48. require('./test-android')