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

Commit 49f8e90

Browse files
committed
Add test case #135
1 parent b22300c commit 49f8e90

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/test-fs.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,35 @@ describe('fs.slice test', (report, done) => {
473473

474474
})
475475

476+
describe('#135 binary data to ascii file size checking', (report, done) => {
477+
478+
let file = null
479+
let expectedSize = 0
480+
481+
RNFetchBlob.config({ fileCache : true })
482+
.fetch('GET', `${TEST_SERVER_URL}/public/beethoven.mp3`)
483+
.then((res) => {
484+
file = res.path()
485+
return fs.stat(file)
486+
})
487+
.then((stat) => {
488+
expectedSize = Math.floor(stat.size)
489+
return fs.readStream(file, 'ascii')
490+
})
491+
.then((stream) => {
492+
let actual = 0
493+
stream.open()
494+
stream.onData((chunk) => {
495+
actual += chunk.length
496+
})
497+
stream.onEnd(() => {
498+
report(<Assert key="check mp3 file size" expect={expectedSize} actual={actual}/>)
499+
done()
500+
})
501+
})
502+
503+
})
504+
476505

477506
function getASCIIArray(str) {
478507
let r = []

0 commit comments

Comments
 (0)