import RNTest from './react-native-testkit/' import React from 'react' import RNFetchBlob from 'react-native-fetch-blob' import { StyleSheet, Text, View, ScrollView, Platform, Dimensions, Image, } from 'react-native'; const fs = RNFetchBlob.fs const { Assert, Comparer, Info, prop } = RNTest const describe = RNTest.config({ group : '0.5.3', run : true, expand : false, }) const { TEST_SERVER_URL_SSL, FILENAME, DROPBOX_TOKEN, styles } = prop() let prefix = ((Platform.OS === 'android') ? 'file://' : '') describe('GET request with params', (report, done) => { let time = Date.now() RNFetchBlob .config({ fileCache : true, trusty : true }) .fetch('GET', `${TEST_SERVER_URL_SSL}/params?time=${time}&name=RNFetchBlobParams&lang=中文`) .then((resp) => { let file = resp.path() return RNFetchBlob.fs.readStream(resp.path(), 'utf8') }) .then((stream) => { let result = '' stream.open() stream.onData((chunk) => { result += chunk }) stream.onEnd(() => { result = JSON.parse(result) report(, , ) done() }) }) }) describe('POST request with params', (report, done) => { let time = Date.now() RNFetchBlob.config({ fileCache : true, trusty : true }) .fetch('POST', `${TEST_SERVER_URL_SSL}/params?time=${time}&name=RNFetchBlobParams&lang=中文`) .then((resp) => { let file = resp.path() return RNFetchBlob.fs.readStream(resp.path(), 'utf8') }) .then((stream) => { let result = '' stream.open() stream.onData((chunk) => { result += chunk }) stream.onEnd(() => { result = JSON.parse(result) report(, , ) done() }) }) })