Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b11919c

Browse files
committedNov 21, 2015
add and cat big file test (failing)
1 parent 0b7ff96 commit b11919c

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed
 

‎test/100mb.random

95.4 MB
Binary file not shown.

‎test/tests.js

+37-1
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ const isNode = !global.window
1212

1313
const testfilePath = __dirname + '/testfile.txt'
1414
let testfile
15+
let testfileBig
1516

1617
if (isNode) {
1718
testfile = require('fs').readFileSync(__dirname + '/testfile.txt')
19+
testfileBig = require('fs').readFileSync(__dirname + '/100mb.random')
1820
} else {
1921
testfile = require('raw!./testfile.txt')
22+
testfileBig = require('raw!./100mb.random')
2023
}
2124

2225
describe('IPFS Node.js API wrapper tests', () => {
@@ -116,12 +119,26 @@ describe('IPFS Node.js API wrapper tests', () => {
116119
if (err) throw err
117120

118121
// assert.equal(res.length, 1)
119-
const added = res[0] != null ? res[0] : res
122+
const added = res[0] !== null ? res[0] : res
120123
assert.equal(added.Hash, 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP')
121124
done()
122125
})
123126
})
124127

128+
it('add BIG buffer', function (done) {
129+
this.timeout(10000)
130+
131+
let buf = new Buffer(testfileBig)
132+
apiClients['a'].add(buf, (err, res) => {
133+
if (err) throw err
134+
135+
// assert.equal(res.length, 1)
136+
const added = res[0] !== null ? res[0] : res
137+
assert.equal(added.Hash, 'Qmaw8jKK2vdd1gxiYqfyXJgVwfibiXiH3H81eVViJRXMJj')
138+
done()
139+
})
140+
})
141+
125142
it('add path', function (done) {
126143
if (!isNode) {
127144
return done()
@@ -203,6 +220,25 @@ describe('IPFS Node.js API wrapper tests', () => {
203220
})
204221
})
205222
})
223+
224+
it('cat BIG file', function (done) {
225+
this.timeout(10000)
226+
227+
apiClients['a'].cat('Qmaw8jKK2vdd1gxiYqfyXJgVwfibiXiH3H81eVViJRXMJj', (err, res) => {
228+
if (err) {
229+
throw err
230+
}
231+
232+
let buf = ''
233+
res
234+
.on('error', err => { throw err })
235+
.on('data', data => buf += data)
236+
.on('end', () => {
237+
assert.equal(buf, testfileBig)
238+
done()
239+
})
240+
})
241+
})
206242
})
207243

208244
describe('.ls', function () {

0 commit comments

Comments
 (0)
This repository has been archived.