Browse Source

Change test case #44

Ben Hsieh 8 years ago
parent
commit
4f6cee60d7
6 changed files with 15 additions and 20 deletions
  1. 2
    2
      test/test-0.5.2.js
  2. 1
    1
      test/test-0.6.3.js
  3. 0
    7
      test/test-0.8.0.js
  4. 1
    0
      test/test-android.js
  5. 2
    1
      test/test-firebase.js
  6. 9
    9
      test/test-init.js

+ 2
- 2
test/test-0.5.2.js View File

27
 describe('GET request with params', (report, done) => {
27
 describe('GET request with params', (report, done) => {
28
   let time = Date.now()
28
   let time = Date.now()
29
   RNFetchBlob.config({ fileCache : true })
29
   RNFetchBlob.config({ fileCache : true })
30
-    .fetch('GET', `${TEST_SERVER_URL}/params?time=${time}&name=RNFetchBlobParams&lang=中文`)
30
+    .fetch('GET', encodeURI(`${TEST_SERVER_URL}/params?time=${time}&name=RNFetchBlobParams&lang=中文`))
31
     .then((resp) => {
31
     .then((resp) => {
32
       let file = resp.path()
32
       let file = resp.path()
33
       return RNFetchBlob.fs.readStream(resp.path(), 'utf8')
33
       return RNFetchBlob.fs.readStream(resp.path(), 'utf8')
58
 describe('POST request with params', (report, done) => {
58
 describe('POST request with params', (report, done) => {
59
   let time = Date.now()
59
   let time = Date.now()
60
   RNFetchBlob.config({ fileCache : true })
60
   RNFetchBlob.config({ fileCache : true })
61
-    .fetch('POST', `${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=中文`), {}, RNFetchBlob.base64.encode('123'))
62
     .then((resp) => {
62
     .then((resp) => {
63
       let file = resp.path()
63
       let file = resp.path()
64
       return RNFetchBlob.fs.readStream(resp.path(), 'utf8')
64
       return RNFetchBlob.fs.readStream(resp.path(), 'utf8')

+ 1
- 1
test/test-0.6.3.js View File

27
 
27
 
28
 let prefix = ((Platform.OS === 'android') ? 'file://' : '')
28
 let prefix = ((Platform.OS === 'android') ? 'file://' : '')
29
 
29
 
30
-describe('massive HTTP request', (report, done) => {
30
+false && describe('massive HTTP request', (report, done) => {
31
 
31
 
32
   let promises = []
32
   let promises = []
33
   let progress = []
33
   let progress = []

+ 0
- 7
test/test-0.8.0.js View File

53
         />)
53
         />)
54
       done()
54
       done()
55
     })
55
     })
56
-
57
 })
56
 })
58
-// 
59
-// describe('automatic response data handing test', (report, done) => {
60
-//
61
-//
62
-//
63
-// })
64
 
57
 
65
 function getASCIIArray(str) {
58
 function getASCIIArray(str) {
66
   let r = []
59
   let r = []

+ 1
- 0
test/test-android.js View File

106
     report(
106
     report(
107
       <Assert key="download manager complete handler" expect={true} actual={true}/>
107
       <Assert key="download manager complete handler" expect={true} actual={true}/>
108
     )
108
     )
109
+    console.log('woo',resp)
109
     return resp.readStream('ascii')
110
     return resp.readStream('ascii')
110
   })
111
   })
111
   .then((stream) => {
112
   .then((stream) => {

+ 2
- 1
test/test-firebase.js View File

66
 
66
 
67
   // create Blob from BASE64 data
67
   // create Blob from BASE64 data
68
   let blob = new Blob(RNTest.prop('image'), { type : 'image/png;BASE64'})
68
   let blob = new Blob(RNTest.prop('image'), { type : 'image/png;BASE64'})
69
-  let testImage = `firebase-test-${Platform.OS}-${new Date().toLocaleString()}.png`
69
+  let testImage = `firebase-test-${Platform.OS}-${new Date()}.png`
70
   RNTest.prop('firebase-image', testImage)
70
   RNTest.prop('firebase-image', testImage)
71
   // start test after Blob created
71
   // start test after Blob created
72
   blob.onCreated(() => {
72
   blob.onCreated(() => {
75
       .child(RNTest.prop('firebase-image'))
75
       .child(RNTest.prop('firebase-image'))
76
       .put(blob, { contentType : 'image/png' })
76
       .put(blob, { contentType : 'image/png' })
77
       .then((snapshot) => {
77
       .then((snapshot) => {
78
+        console.log(snapshot.metadata)
78
         report(<Assert key="upload success"
79
         report(<Assert key="upload success"
79
           expect={true}
80
           expect={true}
80
           actual={true}/>,
81
           actual={true}/>,

+ 9
- 9
test/test-init.js View File

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')
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-firebase')
70
 require('./test-firebase')
71
 require('./test-android')
71
 require('./test-android')