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

feat: update to latest dag-pb.DAGNode API #67

Merged
merged 1 commit into from
Nov 24, 2016
Merged

Conversation

daviddias
Copy link
Member

No description provided.

node3 = node
cb()
})
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can make this a bit nicer,

let nodes = []

async.map([
  'I am 1',
  'I am 2'
  ' I am 3'
], (data, cb) => dagPB.DAGNode.create(new Buffer(data), cb), (err, _nodes) => {
  expect(err).to.not.exist
  nodes = _nodes
  done()
})

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, instead of expect(err).to.not.exist you can pass in err into done() and if it's falsy, test will pass, if truthy it will fail.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@victorbjelkholm true, in an example where the only other thing that happens is an assignment, that would be ok, but if there was more operations between that expect(err) and done, other operations would fail and the error would have the right information for debugging, which would not get printed due to the operations in between failing. For the sake of consistency (check for the error first thing), I keep doing it this way.

@daviddias daviddias merged commit 8a5b201 into master Nov 24, 2016
@daviddias daviddias deleted the feat/awesome-dag-pb branch November 24, 2016 12:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants