浏览代码

Add 0.10.2 test case

Ben Hsieh 7 年前
父节点
当前提交
132bdc7d5d
共有 2 个文件被更改,包括 56 次插入5 次删除
  1. 50
    0
      test/test-0.10.2.js
  2. 6
    5
      test/test-init.js

+ 50
- 0
test/test-0.10.2.js 查看文件

@@ -0,0 +1,50 @@
1
+import RNTest from './react-native-testkit/'
2
+import React from 'react'
3
+import RNFetchBlob from 'react-native-fetch-blob'
4
+import {
5
+  StyleSheet,
6
+  Text,
7
+  View,
8
+  ScrollView,
9
+  Linking,
10
+  Platform,
11
+  Dimensions,
12
+  BackAndroid,
13
+  AsyncStorage,
14
+  Image,
15
+} from 'react-native';
16
+
17
+window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest
18
+window.Blob = RNFetchBlob.polyfill.Blob
19
+
20
+const JSONStream = RNFetchBlob.JSONStream
21
+const fs = RNFetchBlob.fs
22
+const { Assert, Comparer, Info, prop } = RNTest
23
+const describe = RNTest.config({
24
+  group : '0.10.1',
25
+  run : true,
26
+  expand : true,
27
+  timeout : 20000,
28
+})
29
+const { TEST_SERVER_URL, TEST_SERVER_URL_SSL, FILENAME, DROPBOX_TOKEN, styles } = prop()
30
+const dirs = RNFetchBlob.fs.dirs
31
+let prefix = ((Platform.OS === 'android') ? 'file://' : '')
32
+let begin = Date.now()
33
+
34
+
35
+describe('#227 IOS file modification date correctness', (report, done) => {
36
+
37
+  let path = dirs.DocumentDir + '/issue-223-' + Date.now()
38
+  fs.createFile(path, 'datafornow')
39
+  .then(() => fs.stat(path))
40
+  .then((stat) => {
41
+    let date = Math.floor(stat.lastModified);
42
+    console.log(date, stat);
43
+    let correct = date/Date.now() > 0.95 || date/Date.now() < 1.05;
44
+    report(<Assert key="modification date should be correct"
45
+      expect={true} actual={correct}/>);
46
+    done();
47
+
48
+  })
49
+
50
+})

+ 6
- 5
test/test-init.js 查看文件

@@ -18,10 +18,10 @@ const { Assert, Comparer, Info, prop } = RNTest
18 18
 // test environment variables
19 19
 
20 20
 prop('FILENAME', `${Platform.OS}-0.10.0-${Date.now()}.png`)
21
-// prop('TEST_SERVER_URL', 'http://localhost:8123')
22
-// prop('TEST_SERVER_URL_SSL', 'https://localhost:8124')
23
-prop('TEST_SERVER_URL', 'http://192.168.17.185:8123')
24
-prop('TEST_SERVER_URL_SSL', 'https://192.168.17.185:8124')
21
+prop('TEST_SERVER_URL', 'http://localhost:8123')
22
+prop('TEST_SERVER_URL_SSL', 'https://localhost:8124')
23
+// prop('TEST_SERVER_URL', 'http://192.168.17.185:8123')
24
+// prop('TEST_SERVER_URL_SSL', 'https://192.168.17.185:8124')
25 25
 prop('DROPBOX_TOKEN', 'fsXcpmKPrHgAAAAAAAAAoXZhcXYWdgLpQMan6Tb_bzJ237DXhgQSev12hA-gUXt4')
26 26
 prop('styles', {
27 27
   image : {
@@ -74,7 +74,8 @@ describe('GET image from server', (report, done) => {
74 74
 // require('./test-0.9.5')
75 75
 // require('./test-0.9.6')
76 76
 // require('./test-0.10.0')
77
-require('./test-0.10.1')
77
+// require('./test-0.10.1')
78
+require('./test-0.10.2')
78 79
 // require('./test-background.js')
79 80
 // require('./test-stream')
80 81
 // require('./test-fetch')