Skip to content

Only hash option #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Only hash option #4

wants to merge 11 commits into from

Conversation

bmordan
Copy link

@bmordan bmordan commented Sep 8, 2017

This PR adds support for the --only-hash option when using the HTTP client

const FactoryClient = require('./ipfs-factory/client')

const testfile = isNode
? loadFixture(__dirname, '/fixtures/testfile.txt')
: loadFixture(__dirname, 'fixtures/testfile.txt')

// TODO: Test against all algorithms Object.keys(mh.names)
// This subset is known to work with both go-ipfs and js-ipfs as of 2017-09-05
Copy link
Member

Choose a reason for hiding this comment

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

Please reinstate these above const HASH_ALGS = [

const message = `Failed to get block for ${hash}: context canceled`
expect(err.message.indexOf(message)).to.be.above(-1)
})
done()
Copy link
Member

Choose a reason for hiding this comment

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

Not done until after you attempt to fetch the file


const hash = collected[0].Hash

ipfs.files.get(hash, (err, res) => {
Copy link
Member

Choose a reason for hiding this comment

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

Use ipfs refs local for this.

ipfs/js-ipfs#780 (comment)

Rather than use ipfs.get to search for a hash (which should not be there anyway) just use ipfs.refs.local to verify that the hash has not been added to ipfs
Adds promise based tests and uses same method to verify test behaviour
@bmordan
Copy link
Author

bmordan commented Sep 8, 2017

262 tests passing (2m)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants