-
Notifications
You must be signed in to change notification settings - Fork 110
Conversation
7e084ea
to
92cd03c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool stuff! Did these tests got run against js-ipfs-api and js-ipfs?
js/src/bitswap.js
Outdated
}) | ||
|
||
it('.unwant gives error if offline', () => { | ||
expect(() => ipfs.bitswap.unwant('my key'), (err) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will always be an invalid key. It should be tested with a valid key and ensure that the error is because it is offline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok changed that to use a proper key and still expect an error.
@diasdavid oh yeah looks like I forgot to push and make the PR for the js-ipfs-api code this requires. |
92cd03c
to
ef0dc25
Compare
Conflicts resolved, rebased against updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Looks great, just a few minor points to address and it'll be good to merge 🚀
SPEC/BITSWAP.md
Outdated
@@ -4,7 +4,22 @@ | |||
* [bitswap.unwant](#bitswapunwant) | |||
* [bitswap.stat](#bitswapstat) | |||
|
|||
#### `bitswap.wantlist` | |||
#### `unwant` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please could you change to bitswap.unwant
so the link from the TOC works
SPEC/BITSWAP.md
Outdated
|
||
##### `Go` **WIP** | ||
|
||
### `bitswap.wantlist` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please remove these old headers so we don't have duplicates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, had a merge conflict go pear shaped on me. I'll get these cleaned up.
js/src/bitswap.js
Outdated
ipfsB.block.get(new CID(key)) | ||
.then(() => {}) | ||
.catch(() => {}) | ||
setTimeout(cb, 500) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain what's going on here? Maybe also add a comment?
js/src/bitswap.js
Outdated
it('.unwant', (done) => { | ||
ipfsA.bitswap.unwant(new CID(key), (err) => { | ||
ipfsA.bitswap.wantlist((err, list) => { | ||
expect(list).to.be.empty() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also expect(err).to.not.exist()
?
js/src/bitswap.js
Outdated
it('.stat', (done) => { | ||
|
||
ipfsA.bitswap.stat((err, stats) => { | ||
statsTests.expectIsBitswap(err, stats) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also expect(err).to.not.exist()
?
js/src/bitswap.js
Outdated
|
||
it('.stat gives error while offline', () => { | ||
ipfs.bitswap.stat((err, stats) => { | ||
expect(err).to.exist() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we assert against the error message? Just expecting it to exist could give to false positives.
Cleaned up as per review comments. Thanks for the feedback. |
76a0f0e
to
4a21bad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, I noticed a couple more small issues after your changes.
SPEC/BITSWAP.md
Outdated
|
||
### `bitswap.wantlist` | ||
|
||
> Returns the wantlist, optionally limited by peerID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be helpful to clarify if "the wantlist" when not limited by peer ID is a list that everybody shares or if it is just yours.
Also, would "filtered" be a more accurate description than "limited"?
SPEC/BITSWAP.md
Outdated
```JavaScript | ||
ipfs.bitswap.wantlist((err, list) => console.log(list)) | ||
|
||
//[ { Wantlist object }, ... ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate on the shape of the "Wantlist object" here? I think we usually try to in these specs.
4a21bad
to
97334ee
Compare
a459a4e
to
16bbdfe
Compare
16bbdfe
to
9f81bcb
Compare
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
Originally from PR #267 License: MIT Signed-off-by: Alan Shaw <[email protected]>
Originally from PR #267 License: MIT Signed-off-by: Alan Shaw <[email protected]>
Tests for wantlist including with peerId param.
Still need to add copy to SPEC/BITSWAP.md
ETA branched from #254 and that PR should merge before this one.