Kaynağa Gözat

Add test case for #159

Ben Hsieh 8 yıl önce
ebeveyn
işleme
008d75442e
1 değiştirilmiş dosya ile 40 ekleme ve 24 silme
  1. 40
    24
      test/test-0.10.0.js

+ 40
- 24
test/test-0.10.0.js Dosyayı Görüntüle

@@ -89,30 +89,46 @@ let begin = Date.now()
89 89
 //
90 90
 // })
91 91
 
92
-describe('#154 Allow passing unparsed response body to error handler ', (report, done) =>{
93
-
94
-  RNFetchBlob.fetch('get', `${TEST_SERVER_URL}/err-body`)
95
-  .then((res) => {
96
-    console.log(res)
97
-  })
98
-  .catch((err) => {
99
-    console.log(err)
100
-  })
101
-
102
-})
103
-
104
-describe('cookie test', (report, done) => {
92
+// describe('#154 Allow passing unparsed response body to error handler ', (report, done) =>{
93
+//
94
+//   RNFetchBlob.fetch('get', `${TEST_SERVER_URL}/err-body`)
95
+//   .then((res) => {
96
+//     console.log(res)
97
+//   })
98
+//   .catch((err) => {
99
+//     console.log(err)
100
+//   })
101
+//
102
+// })
103
+//
104
+// describe('cookie test', (report, done) => {
105
+//
106
+//   RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/cookie`)
107
+//   .then((res) => {
108
+//     return RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/xhr-header`)
109
+//   })
110
+//   .then((res) => {
111
+//     console.log(res)
112
+//     RNFetchBlob.net.getCookies(`${TEST_SERVER_URL}`)
113
+//     .then((cookies) => {
114
+//       console.log(cookies)
115
+//     })
116
+//   })
117
+//
118
+// })
105 119
 
106
-  RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/cookie`)
107
-  .then((res) => {
108
-    return RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/xhr-header`)
109
-  })
110
-  .then((res) => {
111
-    console.log(res)
112
-    RNFetchBlob.net.getCookies(`${TEST_SERVER_URL}`)
113
-    .then((cookies) => {
114
-      console.log(cookies)
120
+describe('SSL test #159', (report, done) => {
121
+  RNFetchBlob.config({
122
+    trusty : true
123
+    }).fetch('GET', `${TEST_SERVER_URL_SSL}/public/github.png`, {
124
+      'Cache-Control' : 'no-store'
125
+    })
126
+    .then(res => {
127
+      report(<Assert key="trusty request should pass" expect={true} actual={true}/>)
128
+      return RNFetchBlob.fetch('GET',`${TEST_SERVER_URL_SSL}/public/github.png`)
129
+    })
130
+    .catch(e => {
131
+      report(<Assert key="non-trusty request should not pass" expect={true} actual={true}/>)
132
+      done()
115 133
     })
116
-  })
117
-
118 134
 })