Ben Hsieh vor 8 Jahren
Ursprung
Commit
fbdebf001b
4 geänderte Dateien mit 32 neuen und 21 gelöschten Zeilen
  1. 5
    1
      test/test-0.8.0.js
  2. 14
    6
      test/test-blob.js
  3. 13
    13
      test/test-init.js
  4. 0
    1
      test/test-xmlhttp.js

+ 5
- 1
test/test-0.8.0.js Datei anzeigen

@@ -25,7 +25,7 @@ const  dirs = RNFetchBlob.fs.dirs
25 25
 
26 26
 let prefix = ((Platform.OS === 'android') ? 'file://' : '')
27 27
 
28
-describe('URI encoding support', (report, done) => {
28
+describe('fs URI encoding support', (report, done) => {
29 29
 
30 30
   let testData1 = `test date write file from file ${Date.now()}`
31 31
   let testData2 = `test date write file from file ${Date.now()*Math.random()}`
@@ -55,6 +55,10 @@ describe('URI encoding support', (report, done) => {
55 55
     })
56 56
 })
57 57
 
58
+describe('request timeout working properly', (report, done) => {
59
+  done()
60
+})
61
+
58 62
 function getASCIIArray(str) {
59 63
   let r = []
60 64
   for(let i=0;i<str.length;i++) {

+ 14
- 6
test/test-blob.js Datei anzeigen

@@ -103,6 +103,9 @@ describe('blob clear cache test', (report, done) => {
103 103
   let expect = 'test-' + Date.now()
104 104
   Blob.clearCache()
105 105
       .then(() => Blob.build(expect))
106
+      .catch((err) => {
107
+        console.warn(err)
108
+      })
106 109
       .then((b) => fs.readFile(b.getRNFetchBlobRef(), 'utf8'))
107 110
       .then((data) => {
108 111
         report(
@@ -124,17 +127,22 @@ describe('blob clear cache test', (report, done) => {
124 127
 describe('create blob using FormData', (report, done) => {
125 128
   let form = new FormData()
126 129
   let fname = 'blob-test' + Date.now()
127
-  File.build(RNTest.prop('image'), { type:'image/png;base64' })
130
+  File.build('test.png', RNTest.prop('image'), { type:'image/png;base64' })
128 131
       .then((f) => {
129
-        f.name = 'test.png'
130 132
         form.append('name', fname)
131 133
         form.append('blob', f)
132 134
         return Blob.build(form)
133 135
       })
134
-      .then((b) => RNFetchBlob
135
-                    .fetch('POST', `${TEST_SERVER_URL}/upload-form`, {
136
-                      'content-type' : 'multipart/form-data; boundary='+b.multipartBoundary
137
-                    }, RNFetchBlob.wrap(b.getRNFetchBlobRef())))
136
+      .then((b) => {
137
+        let body = RNFetchBlob.wrap(b.getRNFetchBlobRef())
138
+        return RNFetchBlob.fetch(
139
+          'POST',
140
+          `${TEST_SERVER_URL}/upload-form`,
141
+          {
142
+            'content-type' : 'multipart/form-data; boundary='+b.multipartBoundary
143
+          },
144
+          body)
145
+      })
138 146
       .then((resp) => {
139 147
         report(
140 148
           <Assert key="form data verification #1"

+ 13
- 13
test/test-init.js Datei anzeigen

@@ -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.16.70:8123')
22
-prop('TEST_SERVER_URL_SSL', 'https://192.168.16.70: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 : {
@@ -58,16 +58,16 @@ describe('GET image from server', (report, done) => {
58 58
 })
59 59
 
60 60
 
61
-// require('./test-0.1.x-0.4.x')
62
-// require('./test-0.5.1')
63
-// require('./test-0.5.2')
64
-// require('./test-0.6.0')
65
-// require('./test-0.6.2')
66
-// require('./test-0.6.3')
67
-// require('./test-0.7.0')
68
-// require('./test-0.8.0')
69
-// require('./test-fs')
70
-// require('./test-xmlhttp')
61
+require('./test-0.1.x-0.4.x')
62
+require('./test-0.5.1')
63
+require('./test-0.5.2')
64
+require('./test-0.6.0')
65
+require('./test-0.6.2')
66
+require('./test-0.6.3')
67
+require('./test-0.7.0')
68
+require('./test-0.8.0')
69
+require('./test-fs')
70
+require('./test-xmlhttp')
71 71
 require('./test-blob')
72 72
 require('./test-firebase')
73
-// require('./test-android')
73
+require('./test-android')

+ 0
- 1
test/test-xmlhttp.js Datei anzeigen

@@ -19,7 +19,6 @@ const Blob = RNFetchBlob.polyfill.Blob
19 19
 
20 20
 window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest
21 21
 window.Blob = Blob
22
-window.FormData = RNFetchBlob.polyfill.FormData
23 22
 window.ProgressEvent = RNFetchBlob.polyfill.ProgressEvent
24 23
 
25 24
 const { Assert, Comparer, Info, prop } = RNTest