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

test: extend block coverage #266

Merged

Conversation

gavinmcdermott
Copy link
Contributor

block.put now returns a rejected promise when no callback is provided and an error occurs; more tests.

@daviddias
Copy link
Contributor

daviddias commented May 11, 2016

Thank you @gavinmcdermott :)

It LGTM, but I defer the final verdict to our in house promise expert, @dignifiedquire, which added the promise support to tell if this matches the pattern he designed for js-ipfs-api :)

@@ -8,7 +8,11 @@ module.exports = (send) => {
stat: argCommand(send, 'block/stat'),
put (file, cb) {
if (Array.isArray(file)) {
return cb(null, new Error('block.put() only accepts 1 file'))
let err = new Error('block.put() only accepts 1 file')
if (typeof cb !== 'function') {
Copy link
Contributor

Choose a reason for hiding this comment

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

please also check for Promise being defined: https://github.com/ipfs/js-ipfs-api/blob/master/src/api/log.js#L8

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @dignifiedquire, just getting myself up to speed with the libs to contribute more meaningfully in the near term!

Copy link
Contributor

Choose a reason for hiding this comment

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

awesome, thank you @gavinmcdermott :D

@dignifiedquire
Copy link
Contributor

Thanks :octocat:

@dignifiedquire dignifiedquire merged commit 6df8651 into ipfs-inactive:master May 11, 2016
@gavinmcdermott gavinmcdermott deleted the test/extend_block_coverage branch June 16, 2016 23:11
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.

3 participants