Bläddra i källkod

change test config

Ben Hsieh 7 år sedan
förälder
incheckning
25f77e8e20
2 ändrade filer med 28 tillägg och 27 borttagningar
  1. 24
    24
      test/test-0.9.5.js
  2. 4
    3
      test/test-init.js

+ 24
- 24
test/test-0.9.5.js Visa fil

@@ -28,30 +28,30 @@ const dirs = RNFetchBlob.fs.dirs
28 28
 
29 29
 let prefix = ((Platform.OS === 'android') ? 'file://' : '')
30 30
 
31
-// describe('issue #122 force response data format', (report, done) => {
32
-//
33
-//   RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/json-dummy.json`, {
34
-//     'RNFB-Response' : 'base64'
35
-//   })
36
-//   .then((res) => {
37
-//     let r = RNFetchBlob.base64.decode(res.data)
38
-//     report(
39
-//       <Assert key="test data verify" expect="fetchblob-dev" actual={JSON.parse(r).name}/>,
40
-//       <Assert key="should successfully decode the data" expect={true} actual={true}/>)
41
-//     return RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/json-dummy.json`)
42
-//   })
43
-//   .then((res) => {
44
-//     report(
45
-//       <Assert key="response should in format of plain-text" expect="fetchblob-dev" actual={JSON.parse(res.data).name}/>)
46
-//     done()
47
-//   })
48
-//   .catch(() => {
49
-//     report(
50
-//       <Assert key="Should successfully decode the data" expect={true} actual={false}/>)
51
-//     done()
52
-//   })
53
-//
54
-// })
31
+describe('issue #122 force response data format', (report, done) => {
32
+
33
+  RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/json-dummy.json`, {
34
+    'RNFB-Response' : 'base64'
35
+  })
36
+  .then((res) => {
37
+    let r = RNFetchBlob.base64.decode(res.data)
38
+    report(
39
+      <Assert key="test data verify" expect="fetchblob-dev" actual={JSON.parse(r).name}/>,
40
+      <Assert key="should successfully decode the data" expect={true} actual={true}/>)
41
+    return RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/json-dummy.json`)
42
+  })
43
+  .then((res) => {
44
+    report(
45
+      <Assert key="response should in format of plain-text" expect="fetchblob-dev" actual={JSON.parse(res.data).name}/>)
46
+    done()
47
+  })
48
+  .catch(() => {
49
+    report(
50
+      <Assert key="Should successfully decode the data" expect={true} actual={false}/>)
51
+    done()
52
+  })
53
+
54
+})
55 55
 
56 56
 describe('#129 memory leaking when enable uploadProgress', (report, done) => {
57 57
 

+ 4
- 3
test/test-init.js Visa fil

@@ -18,8 +18,8 @@ const { Assert, Comparer, Info, prop } = RNTest
18 18
 // test environment variables
19 19
 
20 20
 prop('FILENAME', `${Platform.OS}-0.8.0-${Date.now()}.png`)
21
-prop('TEST_SERVER_URL', 'http://192.168.0.14:8123')
22
-prop('TEST_SERVER_URL_SSL', 'https://192.168.0.14:8124')
21
+prop('TEST_SERVER_URL', 'http://192.168.0.11:8123')
22
+prop('TEST_SERVER_URL_SSL', 'https://192.168.0.11:8124')
23 23
 prop('DROPBOX_TOKEN', 'fsXcpmKPrHgAAAAAAAAAoXZhcXYWdgLpQMan6Tb_bzJ237DXhgQSev12hA-gUXt4')
24 24
 prop('styles', {
25 25
   image : {
@@ -69,7 +69,8 @@ describe('GET image from server', (report, done) => {
69 69
 // require('./test-0.9.0')
70 70
 // require('./test-0.9.2')
71 71
 // require('./test-0.9.4')
72
-require('./test-0.9.5')
72
+// require('./test-0.9.5')
73
+require('./test-0.9.6')
73 74
 // require('./test-fetch')
74 75
 // require('./test-fs')
75 76
 // require('./test-xmlhttp')