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

Commit 58205e5

Browse files
committed
Change test cases
1 parent 83b208f commit 58205e5

File tree

7 files changed

+18
-10
lines changed

7 files changed

+18
-10
lines changed

test/test-0.5.2.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ describe('GET request with params', (report, done) => {
5858
describe('POST request with params', (report, done) => {
5959
let time = Date.now()
6060
RNFetchBlob.config({ fileCache : true })
61-
.fetch('POST', encodeURI(`${TEST_SERVER_URL}/params?time=${time}&name=RNFetchBlobParams&lang=中文`), {}, RNFetchBlob.base64.encode('123'))
61+
.fetch('POST', encodeURI(`${TEST_SERVER_URL}/params?time=${time}&name=RNFetchBlobParams&lang=中文`),
62+
{
63+
'Content-Type' : 'image/png;BASE64'
64+
}, RNFetchBlob.base64.encode('123'))
6265
.then((resp) => {
6366
let file = resp.path()
6467
return RNFetchBlob.fs.readStream(resp.path(), 'utf8')

test/test-0.6.2.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ describe('Check custom MIME type correctness',(report, done) => {
183183
.config({fileCache : true})
184184
.fetch('GET', `${TEST_SERVER_URL}/public/beethoven.mp3`)
185185
.then((resp) => {
186-
return RNFetchBlob.fetch('POST', `${TEST_SERVER_URL}/mime`, null, [
186+
return RNFetchBlob.fetch('POST', `${TEST_SERVER_URL}/mime`, {
187+
'Content-Type' : 'multipart/form-data'
188+
}, [
187189
{ name : 'image', filename : 'image', type : 'image/jpeg', data : RNFetchBlob.base64.encode('123456') },
188190
{ name : 'mp3', filename : 'mp3', type : 'application/mp3', data : RNFetchBlob.base64.encode('123456') },
189191
{ name : 'mp3', filename : 'mp3', data : RNFetchBlob.base64.encode('123456') },

test/test-0.7.0.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('Upload and download large file', (report, done) => {
3636
RNFetchBlob.config({
3737
fileCache : true
3838
})
39-
.fetch('GET', `${TEST_SERVER_URL}/public/22mb-dummy`)
39+
.fetch('GET', `${TEST_SERVER_URL}/public/1mb-dummy`)
4040
.progress((now, total) => {
4141
if(begin === -1)
4242
begin = Date.now()
@@ -114,6 +114,7 @@ describe('cancel task should work properly', (report, done) => {
114114
report(<Assert key="task cancelled rejection should be catachable"
115115
expect={true}
116116
actual={true}/>)
117+
done()
117118
})
118119

119120
})

test/test-0.9.0.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const { Assert, Comparer, Info, prop } = RNTest
2424
const describe = RNTest.config({
2525
group : '0.9.0',
2626
run : true,
27-
expand : true,
27+
expand : false,
2828
timeout : 20000,
2929
})
3030
const { TEST_SERVER_URL, TEST_SERVER_URL_SSL, FILENAME, DROPBOX_TOKEN, styles } = prop()

test/test-0.9.2.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ describe('slice test', (report, done) => {
8282
})
8383

8484
describe('Upload multipart/form-data', (report, done) => {
85-
85+
let image = RNTest.prop('image')
8686
RNFetchBlob.fetch('POST', `${TEST_SERVER_URL}/upload-form`, {
8787
Authorization : "Bearer fsXcpmKPrHgAAAAAAAAAEGxFXwhejXM_E8fznZoXPhHbhbNhA-Lytbe6etp1Jznz",
8888
'Content-Type' : 'multipart/form-data',
8989
}, [
90-
// { name : 'test-img', filename : 'test-img.png', data: image},
91-
// { name : 'test-text', filename : 'test-text.txt', data: RNFetchBlob.base64.encode('hello.txt')},
90+
{ name : 'test-img', filename : 'test-img.png', data: image},
91+
{ name : 'test-text', filename : 'test-text.txt', data: RNFetchBlob.base64.encode('hello.txt')},
9292
{ name : 'field1', data : 'hello !!'},
9393
{ name : 'field2', data : 'hello2 !!'}
9494
])

test/test-firebase.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ import {
1616
} from 'react-native';
1717

1818
const fs = RNFetchBlob.fs
19-
const Blob = RNFetchBlob.polyfill.Blob
2019

2120
window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest
22-
window.Blob = Blob
21+
window.Blob = RNFetchBlob.polyfill.Blob
2322

2423
const { Assert, Comparer, Info, prop } = RNTest
2524
const describe = RNTest.config({
@@ -41,10 +40,11 @@ var config = {
4140
databaseURL: "https://rnfb-test-app.firebaseio.com",
4241
storageBucket: "rnfb-test-app.appspot.com",
4342
};
44-
firebase.initializeApp(config);
43+
4544

4645
describe('firebase login', (report, done) => {
4746

47+
firebase.initializeApp(config);
4848
firebase.auth().signInWithEmailAndPassword('[email protected]', 'rnfbtest1024')
4949
.catch((err) => {
5050
console.log('firebase sigin failed', err)

test/test-fs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
Text,
88
View,
99
ScrollView,
10+
Platform,
1011
Dimensions,
1112
Image,
1213
} from 'react-native';
@@ -20,6 +21,7 @@ const describe = RNTest.config({
2021

2122
let { TEST_SERVER_URL, FILENAME, DROPBOX_TOKEN, styles, image } = prop()
2223
let dirs = RNFetchBlob.fs.dirs
24+
let prefix = ((Platform.OS === 'android') ? 'file://' : '')
2325

2426
describe('Get storage folders', (report, done) => {
2527
report(

0 commit comments

Comments
 (0)