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

test: add CID version agnostic tests #413

Merged
merged 2 commits into from
Dec 12, 2018
Merged

Conversation

alanshaw
Copy link
Contributor

@alanshaw alanshaw commented Dec 9, 2018

No description provided.

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
@ghost ghost assigned alanshaw Dec 9, 2018
@ghost ghost added the in progress label Dec 9, 2018
alanshaw added a commit to ipfs-inactive/js-ipfs-http-client that referenced this pull request Dec 9, 2018
The CID version agnostic tests ipfs-inactive/interface-js-ipfs-core#413 identified some functions were not properly serializing CID instances. This PR adds `cleanCID` step to several functions and also updates the `cleanCID` function to not assume buffer CIDs are CIDv0 multihashes.

depends on ipfs-inactive/interface-js-ipfs-core#413

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
Copy link
Collaborator

@achingbrain achingbrain left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -4,6 +4,7 @@
const multihash = require('multihashes')
const CID = require('cids')
const auto = require('async/auto')
const crypto = require('crypto')
Copy link
Contributor

Choose a reason for hiding this comment

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

Do the bytes need to be so random that it requires to add the crypto module (and respective browser polyfill?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, and it's probably faster to just use Date.now() or Math.random(). I've removed all instances of crypto. There's one test that generates lots of random data to ensure it spans multiple dag nodes and I've changed that test to use randombytes so we don't pull in the whole of crypto in the browser.

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
@alanshaw
Copy link
Contributor Author

Assuming this PR is gtg now @daviddias - please shout if you have further changes and I'll submit another PR!

@alanshaw alanshaw merged commit b7fad99 into master Dec 12, 2018
@alanshaw alanshaw deleted the test/cid-version-agnostic branch December 12, 2018 09:07
@ghost ghost removed the in progress label Dec 12, 2018
alanshaw added a commit to ipfs-inactive/js-ipfs-http-client that referenced this pull request Dec 12, 2018
The CID version agnostic tests ipfs-inactive/interface-js-ipfs-core#413 identified some functions were not properly serializing CID instances. This PR adds `cleanCID` step to several functions and also updates the `cleanCID` function to not assume buffer CIDs are CIDv0 multihashes.

depends on ipfs-inactive/interface-js-ipfs-core#413

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
alanshaw added a commit to ipfs-inactive/js-ipfs-http-client that referenced this pull request Dec 13, 2018
The CID version agnostic tests ipfs-inactive/interface-js-ipfs-core#413 identified some functions were not properly serializing CID instances. This PR adds `cleanCID` step to several functions and also updates the `cleanCID` function to not assume buffer CIDs are CIDv0 multihashes.

depends on ipfs-inactive/interface-js-ipfs-core#413


License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>

* fix: disable just the rule we're breaking

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>

* chore: update dependencies

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>

* fix: skip test that go-ipfs cannot pass



License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
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