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

Commit 8158667

Browse files
committed
fix: object.stat test was not passing the encoding of the multihash
1 parent da0acdc commit 8158667

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

src/object.js

+26-13
Original file line numberDiff line numberDiff line change
@@ -833,19 +833,32 @@ module.exports = (common) => {
833833
})
834834
})
835835

836-
it('object.stat', () => {
837-
return ipfs.object.stat('QmNggDXca24S6cMPEYHZjeuc4QRmofkRrAEqVL3Ms2sdJZ')
838-
.then((stats) => {
839-
const expected = {
840-
Hash: 'QmNggDXca24S6cMPEYHZjeuc4QRmofkRrAEqVL3Ms2sdJZ',
841-
NumLinks: 0,
842-
BlockSize: 17,
843-
LinksSize: 2,
844-
DataSize: 15,
845-
CumulativeSize: 17
846-
}
847-
expect(expected).to.deep.equal(stats)
848-
})
836+
it('object.stat', (done) => {
837+
const testObj = {
838+
Data: new Buffer('get test object'),
839+
Links: []
840+
}
841+
842+
ipfs.object.put(testObj, (err, node) => {
843+
expect(err).to.not.exist
844+
845+
ipfs.object.stat('QmNggDXca24S6cMPEYHZjeuc4QRmofkRrAEqVL3Ms2sdJZ', {enc: 'base58'})
846+
.then((stats) => {
847+
const expected = {
848+
Hash: 'QmNggDXca24S6cMPEYHZjeuc4QRmofkRrAEqVL3Ms2sdJZ',
849+
NumLinks: 0,
850+
BlockSize: 17,
851+
LinksSize: 2,
852+
DataSize: 15,
853+
CumulativeSize: 17
854+
}
855+
expect(expected).to.deep.equal(stats)
856+
done()
857+
})
858+
.catch((err) => {
859+
expect(err).to.not.exist
860+
})
861+
})
849862
})
850863

851864
it('object.links', (done) => {

0 commit comments

Comments
 (0)