Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit 3c9d0d9

Browse files
committed
Add test case #72
1 parent d368bc1 commit 3c9d0d9

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

test/test-0.8.2.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from 'react-native';
1414

1515
window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest
16-
window.Blob = Blob
16+
window.Blob = RNFetchBlob.polyfill.Blob
1717
window.fetch = new RNFetchBlob.polyfill.Fetch({
1818
auto : true,
1919
binaryContentTypes : ['image/', 'video/', 'audio/']
@@ -46,3 +46,26 @@ describe('whatwg-fetch - GET should work correctly', (report, done) => {
4646
done()
4747
})
4848
})
49+
50+
RNTest.config({
51+
group : '0.8.2',
52+
run : true,
53+
expand : false,
54+
timeout : 24000
55+
})('request should not retry after timed out', (report, done) => {
56+
57+
let count = 0
58+
RNFetchBlob
59+
.config({ timeout : 3000 })
60+
.fetch('GET', `${TEST_SERVER_URL}/timeout`)
61+
.then((res) => {
62+
report(<Assert key="request should not success" expect={true} actual={false}/>)
63+
})
64+
.catch(() => {
65+
count ++
66+
})
67+
setTimeout(() => {
68+
report(<Assert key="request does not retry" expect={1} actual={count}/>)
69+
done()
70+
}, 12000)
71+
})

0 commit comments

Comments
 (0)