소스 검색

Correct test case

Ben Hsieh 8 년 전
부모
커밋
9a94f72c84
2개의 변경된 파일9개의 추가작업 그리고 5개의 파일을 삭제
  1. 8
    5
      test/test-0.6.2.js
  2. 1
    0
      test/test-init.js

+ 8
- 5
test/test-0.6.2.js 파일 보기

@@ -28,27 +28,30 @@ let prefix = ((Platform.OS === 'android') ? 'file://' : '')
28 28
 let photo = null
29 29
 
30 30
 describe('upload asset from camera roll', (report, done) => {
31
-  let imgName = `image-from-camera-roll-${Platform.OS}.jpg`
31
+  let imgName = `image-from-camera-roll-${Platform.OS}-${Date.now()}.jpg`
32 32
   let tick = Date.now()
33
+  let tick2 = Date.now()
33 34
   CameraRoll.getPhotos({first : 10})
34 35
     .then((resp) => {
35
-      console.log('cameraroll', JSON.stringify(resp))
36 36
       let url = resp.edges[0].node.image.uri
37
+      console.log('CameraRoll',url)
37 38
       photo = url
38 39
       return RNFetchBlob.fetch('POST', 'https://content.dropboxapi.com/2/files/upload', {
39 40
         Authorization : `Bearer ${DROPBOX_TOKEN}`,
40 41
         'Dropbox-API-Arg': `{\"path\": \"/rn-upload/${imgName}\",\"mode\": \"add\",\"autorename\": false,\"mute\": false}`,
41 42
         'Content-Type' : 'application/octet-stream',
42 43
       }, RNFetchBlob.wrap(url))
43
-      .progress((now, total) => {
44
-        if(Date.now() - tick < 1000)
44
+      .uploadProgress((now, total) => {
45
+        if(Date.now() - tick2 < 1000)
45 46
         return
46
-        report(<Info key="progress" uid="pg1">
47
+        report(<Info key="upload progress" uid="pg0">
47 48
           <Text>{`upload ${now} / ${total} ${Math.floor(now/total*100)}% `}</Text>
48 49
         </Info>)
50
+        tick2 = Date.now()
49 51
       })
50 52
     })
51 53
     .then((resp) => {
54
+      console.log(resp)
52 55
       resp = resp.json()
53 56
       report(
54 57
         <Assert key="confirm the file has been uploaded" expect={imgName} actual={resp.name}/>

+ 1
- 0
test/test-init.js 파일 보기

@@ -71,3 +71,4 @@ require('./test-xmlhttp')
71 71
 require('./test-blob')
72 72
 require('./test-firebase')
73 73
 require('./test-android')
74
+require('./benchmark')