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

fix: add test for block rm #367

Closed
wants to merge 1 commit into from
Closed

fix: add test for block rm #367

wants to merge 1 commit into from

Conversation

vmx
Copy link
Contributor

@vmx vmx commented Sep 17, 2018

Sadly those tests can't be enabled yet as js-ipfs-api doesn't implement block/rm yet (see ipfs-inactive/js-ipfs-http-client#792).

But I thought I make a pull request with the test though, so that work doesn't get wasted.

@ghost ghost assigned vmx Sep 17, 2018
@ghost ghost added the in progress label Sep 17, 2018
it('should error on removing non-existent block', (done) => {
const cid = new CID('QmYi5NFboBxXvdoRDSa7LaLcQvCukULCaDbZKXUXz4umPa')
ipfs.block.rm(cid, (err, block) => {
expect(err).to.exist()
Copy link
Contributor

Choose a reason for hiding this comment

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

We should make sure the error message contains whatever we expect it to have inside of it.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

const cid = new CID(hash)
ipfs.block.rm(cid, (err) => {
expect(err).to.not.exist()
done()
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to make sure the block was removed, but I'm not sure if we have any public API for checking if a block already exists locally?

Copy link
Contributor

Choose a reason for hiding this comment

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

const cid = new CID(hash)
ipfs.block.rm(cid, (err) => {
expect(err).to.not.exist()
done()
Copy link
Contributor

Choose a reason for hiding this comment

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

it('should error on removing non-existent block', (done) => {
const cid = new CID('QmYi5NFboBxXvdoRDSa7LaLcQvCukULCaDbZKXUXz4umPa')
ipfs.block.rm(cid, (err, block) => {
expect(err).to.exist()
Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@alanshaw
Copy link
Contributor

@vmx any chance you can fix these up?

@vmx
Copy link
Contributor Author

vmx commented Oct 15, 2018

@alanshaw The problem is that this change has a looooong tail. IIRC things are not implemented as expected/correctly. But I'll have a another look at the test, it's worth adding it even if we need to skip it atm.

@alanshaw
Copy link
Contributor

I'm happy to add skips where appropriate as long as the tests are passing in at least one of js-ipfs or js-ipfs-api 🚀

@daviddias
Copy link
Contributor

block.rm was deleted from the API as it messes with Pinning for go-ipfs. Read ipfs-inactive/js-ipfs-http-client#792

Copy link
Contributor

@daviddias daviddias left a comment

Choose a reason for hiding this comment

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

Needs #367 (comment) to be solved

@achingbrain
Copy link
Collaborator

Slightly more comprehensive tests were added in #487 and the implementation will ship with ipfs@0.39.0

@achingbrain achingbrain closed this Oct 8, 2019
@achingbrain achingbrain deleted the block-rm branch October 8, 2019 11:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants