Nessuna descrizione

test-init.js 1.4KB

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