Skip to content

Commit 132bdc7

Browse files
committed
Add 0.10.2 test case
1 parent a454910 commit 132bdc7

File tree

2 files changed

+56
-5
lines changed

2 files changed

+56
-5
lines changed

test/test-0.10.2.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
})

test/test-init.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ const { Assert, Comparer, Info, prop } = RNTest
1818
// test environment variables
1919

2020
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')
2525
prop('DROPBOX_TOKEN', 'fsXcpmKPrHgAAAAAAAAAoXZhcXYWdgLpQMan6Tb_bzJ237DXhgQSev12hA-gUXt4')
2626
prop('styles', {
2727
image : {
@@ -74,7 +74,8 @@ describe('GET image from server', (report, done) => {
7474
// require('./test-0.9.5')
7575
// require('./test-0.9.6')
7676
// require('./test-0.10.0')
77-
require('./test-0.10.1')
77+
// require('./test-0.10.1')
78+
require('./test-0.10.2')
7879
// require('./test-background.js')
7980
// require('./test-stream')
8081
// require('./test-fetch')

0 commit comments

Comments
 (0)