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

Commit ea2b11a

Browse files
committed
Add test case #173
1 parent 06725ec commit ea2b11a

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

test/test-0.10.0.js

+43
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,46 @@ describe('#171 appendExt verify', (report, done) => {
127127
})
128128

129129
})
130+
131+
describe('#173 issue with append option', (report, done) => {
132+
let dest = dirs.DocumentDir + '/tmp' + Date.now()
133+
RNFetchBlob.config({
134+
path : dest,
135+
overwrite : true
136+
})
137+
.fetch('GET', `${TEST_SERVER_URL}/public/github.png`)
138+
.then((res) => fs.stat(res.path()))
139+
.then((stat) => {
140+
report(<Assert key="file size check #1" expect="23975" actual={stat.size}/>)
141+
return RNFetchBlob.config({
142+
path : dest,
143+
overwrite : false
144+
})
145+
.fetch('GET', `${TEST_SERVER_URL}/public/github.png`)
146+
})
147+
.then((res) => fs.stat(res.path()))
148+
.then((stat) => {
149+
report(<Assert key="file size check #2" expect="47950" actual={stat.size}/>)
150+
return RNFetchBlob.config({
151+
path : dest,
152+
overwrite : true
153+
})
154+
.fetch('GET', `${TEST_SERVER_URL}/public/github.png`)
155+
})
156+
.then((res) => fs.stat(res.path()))
157+
.then((stat) => {
158+
report(<Assert key="file size check #3" expect="23975" actual={stat.size}/>)
159+
return RNFetchBlob.config({
160+
path : dest,
161+
})
162+
.fetch('GET', `${TEST_SERVER_URL}/public/github.png`)
163+
})
164+
.then((res) => fs.stat(res.path()))
165+
.then((stat) => {
166+
report(<Assert key="it should successfully overwrite existing file without config"
167+
expect="23975"
168+
actual={stat.size}/>)
169+
done()
170+
})
171+
172+
})

0 commit comments

Comments
 (0)