Browse Source

Add test case

Ben Hsieh 8 years ago
parent
commit
4a99eb55da
2 changed files with 18 additions and 3 deletions
  1. 15
    1
      test/test-0.10.2.js
  2. 3
    2
      test/test-init.js

+ 15
- 1
test/test-0.10.2.js View File

1
 import RNTest from './react-native-testkit/'
1
 import RNTest from './react-native-testkit/'
2
 import React from 'react'
2
 import React from 'react'
3
+import _ from 'lodash'
3
 import RNFetchBlob from 'react-native-fetch-blob'
4
 import RNFetchBlob from 'react-native-fetch-blob'
4
 import {
5
 import {
5
   StyleSheet,
6
   StyleSheet,
21
 const fs = RNFetchBlob.fs
22
 const fs = RNFetchBlob.fs
22
 const { Assert, Comparer, Info, prop } = RNTest
23
 const { Assert, Comparer, Info, prop } = RNTest
23
 const describe = RNTest.config({
24
 const describe = RNTest.config({
24
-  group : '0.10.1',
25
+  group : '0.10.2',
25
   run : true,
26
   run : true,
26
   expand : true,
27
   expand : true,
27
   timeout : 20000,
28
   timeout : 20000,
62
 
63
 
63
 })
64
 })
64
 
65
 
66
+describe('#240 openDocument does not support file URI', (report, done) => {
67
+  RNFetchBlob
68
+  .config({ fileCache : true })
69
+  .fetch('GET', `${TEST_SERVER_URL}/public/github.png`)
70
+  .then((res) => {
71
+    RNFetchBlob.ios.openDocument(res.path())
72
+    .then(() => {
73
+      done();
74
+    })
75
+  })
76
+
77
+})
78
+
65
 describe('#241 null header silent failed issue', (report, done) => {
79
 describe('#241 null header silent failed issue', (report, done) => {
66
 
80
 
67
   RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/github.png`, {
81
   RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/github.png`, {

+ 3
- 2
test/test-init.js View File

1
 import RNTest from './react-native-testkit/'
1
 import RNTest from './react-native-testkit/'
2
 import React from 'react'
2
 import React from 'react'
3
+import _ from 'lodash'
3
 import RNFetchBlob from 'react-native-fetch-blob'
4
 import RNFetchBlob from 'react-native-fetch-blob'
4
 
5
 
5
 import {
6
 import {
20
 prop('FILENAME', `${Platform.OS}-0.10.0-${Date.now()}.png`)
21
 prop('FILENAME', `${Platform.OS}-0.10.0-${Date.now()}.png`)
21
 prop('TEST_SERVER_URL', 'http://localhost:8123')
22
 prop('TEST_SERVER_URL', 'http://localhost:8123')
22
 prop('TEST_SERVER_URL_SSL', 'https://localhost:8124')
23
 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')
24
+// prop('TEST_SERVER_URL', 'http://192.168.0.13:8123')
25
+// prop('TEST_SERVER_URL_SSL', 'https://192.168.0.13:8124')
25
 prop('DROPBOX_TOKEN', 'fsXcpmKPrHgAAAAAAAAAoXZhcXYWdgLpQMan6Tb_bzJ237DXhgQSev12hA-gUXt4')
26
 prop('DROPBOX_TOKEN', 'fsXcpmKPrHgAAAAAAAAAoXZhcXYWdgLpQMan6Tb_bzJ237DXhgQSev12hA-gUXt4')
26
 prop('styles', {
27
 prop('styles', {
27
   image : {
28
   image : {