Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Commit

Permalink
fix: updates ipld-dag-pb dep to version
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
DAGNodes no longer have `.cid` or `.multihash` properties - see
ipld/js-ipld-dag-pb#99 for more and and
#173 for the performance win.

Follows on from ipld/js-ipld-dag-pb#99 and updates this module to
not rely on DAGNodes having knowledge of their CIDs.

Fixes the tests which could use a closer look at, for example they
overwrite the value of `node3` twice.
  • Loading branch information
achingbrain authored and vmx committed Nov 10, 2018
1 parent 3506966 commit add49fe
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 22 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"ipfs-block-service": "~0.15.0",
"ipfs-repo": "~0.25.0",
"ipld-dag-cbor": "~0.13.0",
"ipld-dag-pb": "~0.14.11",
"ipld-dag-pb": "~0.15.0",
"ipld-raw": "^2.0.1",
"merge-options": "^1.0.1",
"pull-defer": "~0.2.3",
Expand Down
54 changes: 33 additions & 21 deletions test/ipld-dag-pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,36 +51,48 @@ module.exports = (repo) => {
})
},
(cb) => {
dagPB.DAGNode.addLink(node2, {
name: '1',
size: node1.size,
multihash: node1.multihash
}, (err, node) => {
dagPB.util.cid(node1, (err, cid) => {
expect(err).to.not.exist()
node2 = node
cb()

dagPB.DAGNode.addLink(node2, {
name: '1',
size: node1.size,
cid
}, (err, node) => {
expect(err).to.not.exist()
node2 = node
cb()
})
})
},
(cb) => {
dagPB.DAGNode.addLink(node3, {
name: '1',
size: node1.size,
multihash: node1.multihash
}, (err, node) => {
dagPB.util.cid(node1, (err, cid) => {
expect(err).to.not.exist()
node3 = node
cb()

dagPB.DAGNode.addLink(node3, {
name: '1',
size: node1.size,
cid
}, (err, node) => {
expect(err).to.not.exist()
node3 = node
cb()
})
})
},
(cb) => {
dagPB.DAGNode.addLink(node3, {
name: '2',
size: node2.size,
multihash: node2.multihash
}, (err, node) => {
dagPB.util.cid(node2, (err, cid) => {
expect(err).to.not.exist()
node3 = node
cb()

dagPB.DAGNode.addLink(node3, {
name: '2',
size: node2.size,
cid
}, (err, node) => {
expect(err).to.not.exist()
node3 = node
cb()
})
})
}
], cids)
Expand Down

0 comments on commit add49fe

Please sign in to comment.