Skip to content
This repository was archived by the owner on Aug 12, 2020. It is now read-only.

Commit 15d5687

Browse files
test: import - export with size check
1 parent 73cf78a commit 15d5687

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/test-exporter.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,27 @@ module.exports = (repo) => {
2424
ds = new DAGService(bs)
2525
})
2626

27+
it('import and export', (done) => {
28+
pull(
29+
pull.values([{
30+
path: '1.2MiB.txt',
31+
content: pull.values([bigFile, Buffer('hello world')])
32+
}]),
33+
unixFSEngine.importer(ds),
34+
pull.map((file) => {
35+
expect(file.path).to.be.eql('1.2MiB.txt')
36+
37+
return exporter(file.multihash, ds)
38+
}),
39+
pull.flatten(),
40+
pull.collect((err, files) => {
41+
expect(err).to.not.exist
42+
expect(files[0].size).to.be.eql(bigFile.length + 11)
43+
fileEql(files[0], Buffer.concat([bigFile, Buffer('hello world')]), done)
44+
})
45+
)
46+
})
47+
2748
it('ensure hash inputs are sanitized', (done) => {
2849
const hash = 'QmQmZQxSKQppbsWfVzBvg59Cn3DKtsNVQ94bjAxg2h3Lb8'
2950
const mhBuf = new Buffer(bs58.decode(hash))

0 commit comments

Comments
 (0)