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

Commit

Permalink
Add test case #173
Browse files Browse the repository at this point in the history
  • Loading branch information
wkh237 committed Nov 4, 2016
1 parent 06725ec commit ea2b11a
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions test/test-0.10.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,46 @@ describe('#171 appendExt verify', (report, done) => {
})

})

describe('#173 issue with append option', (report, done) => {
let dest = dirs.DocumentDir + '/tmp' + Date.now()
RNFetchBlob.config({
path : dest,
overwrite : true
})
.fetch('GET', `${TEST_SERVER_URL}/public/github.png`)
.then((res) => fs.stat(res.path()))
.then((stat) => {
report(<Assert key="file size check #1" expect="23975" actual={stat.size}/>)
return RNFetchBlob.config({
path : dest,
overwrite : false
})
.fetch('GET', `${TEST_SERVER_URL}/public/github.png`)
})
.then((res) => fs.stat(res.path()))
.then((stat) => {
report(<Assert key="file size check #2" expect="47950" actual={stat.size}/>)
return RNFetchBlob.config({
path : dest,
overwrite : true
})
.fetch('GET', `${TEST_SERVER_URL}/public/github.png`)
})
.then((res) => fs.stat(res.path()))
.then((stat) => {
report(<Assert key="file size check #3" expect="23975" actual={stat.size}/>)
return RNFetchBlob.config({
path : dest,
})
.fetch('GET', `${TEST_SERVER_URL}/public/github.png`)
})
.then((res) => fs.stat(res.path()))
.then((stat) => {
report(<Assert key="it should successfully overwrite existing file without config"
expect="23975"
actual={stat.size}/>)
done()
})

})

0 comments on commit ea2b11a

Please sign in to comment.