Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

Commit

Permalink
Ad test case #44
Browse files Browse the repository at this point in the history
  • Loading branch information
wkh237 committed Jul 29, 2016
1 parent 2c0a130 commit fbdebf0
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 21 deletions.
6 changes: 5 additions & 1 deletion test/test-0.8.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const dirs = RNFetchBlob.fs.dirs

let prefix = ((Platform.OS === 'android') ? 'file://' : '')

describe('URI encoding support', (report, done) => {
describe('fs URI encoding support', (report, done) => {

let testData1 = `test date write file from file ${Date.now()}`
let testData2 = `test date write file from file ${Date.now()*Math.random()}`
Expand Down Expand Up @@ -55,6 +55,10 @@ describe('URI encoding support', (report, done) => {
})
})

describe('request timeout working properly', (report, done) => {
done()
})

function getASCIIArray(str) {
let r = []
for(let i=0;i<str.length;i++) {
Expand Down
20 changes: 14 additions & 6 deletions test/test-blob.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ describe('blob clear cache test', (report, done) => {
let expect = 'test-' + Date.now()
Blob.clearCache()
.then(() => Blob.build(expect))
.catch((err) => {
console.warn(err)
})
.then((b) => fs.readFile(b.getRNFetchBlobRef(), 'utf8'))
.then((data) => {
report(
Expand All @@ -124,17 +127,22 @@ describe('blob clear cache test', (report, done) => {
describe('create blob using FormData', (report, done) => {
let form = new FormData()
let fname = 'blob-test' + Date.now()
File.build(RNTest.prop('image'), { type:'image/png;base64' })
File.build('test.png', RNTest.prop('image'), { type:'image/png;base64' })
.then((f) => {
f.name = 'test.png'
form.append('name', fname)
form.append('blob', f)
return Blob.build(form)
})
.then((b) => RNFetchBlob
.fetch('POST', `${TEST_SERVER_URL}/upload-form`, {
'content-type' : 'multipart/form-data; boundary='+b.multipartBoundary
}, RNFetchBlob.wrap(b.getRNFetchBlobRef())))
.then((b) => {
let body = RNFetchBlob.wrap(b.getRNFetchBlobRef())
return RNFetchBlob.fetch(
'POST',
`${TEST_SERVER_URL}/upload-form`,
{
'content-type' : 'multipart/form-data; boundary='+b.multipartBoundary
},
body)
})
.then((resp) => {
report(
<Assert key="form data verification #1"
Expand Down
26 changes: 13 additions & 13 deletions test/test-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const { Assert, Comparer, Info, prop } = RNTest
// test environment variables

prop('FILENAME', `${Platform.OS}-0.8.0-${Date.now()}.png`)
prop('TEST_SERVER_URL', 'http://192.168.16.70:8123')
prop('TEST_SERVER_URL_SSL', 'https://192.168.16.70:8124')
prop('TEST_SERVER_URL', 'http://192.168.0.11:8123')
prop('TEST_SERVER_URL_SSL', 'https://192.168.0.11:8124')
prop('DROPBOX_TOKEN', 'fsXcpmKPrHgAAAAAAAAAoXZhcXYWdgLpQMan6Tb_bzJ237DXhgQSev12hA-gUXt4')
prop('styles', {
image : {
Expand Down Expand Up @@ -58,16 +58,16 @@ describe('GET image from server', (report, done) => {
})


// require('./test-0.1.x-0.4.x')
// require('./test-0.5.1')
// require('./test-0.5.2')
// require('./test-0.6.0')
// require('./test-0.6.2')
// require('./test-0.6.3')
// require('./test-0.7.0')
// require('./test-0.8.0')
// require('./test-fs')
// require('./test-xmlhttp')
require('./test-0.1.x-0.4.x')
require('./test-0.5.1')
require('./test-0.5.2')
require('./test-0.6.0')
require('./test-0.6.2')
require('./test-0.6.3')
require('./test-0.7.0')
require('./test-0.8.0')
require('./test-fs')
require('./test-xmlhttp')
require('./test-blob')
require('./test-firebase')
// require('./test-android')
require('./test-android')
1 change: 0 additions & 1 deletion test/test-xmlhttp.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const Blob = RNFetchBlob.polyfill.Blob

window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest
window.Blob = Blob
window.FormData = RNFetchBlob.polyfill.FormData
window.ProgressEvent = RNFetchBlob.polyfill.ProgressEvent

const { Assert, Comparer, Info, prop } = RNTest
Expand Down

0 comments on commit fbdebf0

Please sign in to comment.