This repository has been archived by the owner on Mar 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move tests from js-ipfs-api to interface-ipfs-core
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* eslint-env mocha */ | ||
'use strict' | ||
|
||
const expect = require('chai').expect | ||
|
||
module.exports = (common) => { | ||
describe.only('.dht', () => { | ||
let ipfs | ||
|
||
before((done) => { | ||
common.setup((err, factory) => { | ||
expect(err).to.not.exists | ||
factory.spawnNode((err, node) => { | ||
expect(err).to.not.exist | ||
ipfs = node | ||
done() | ||
}) | ||
}) | ||
}) | ||
|
||
after((done) => { | ||
common.teardown(done) | ||
}) | ||
xdescribe('.findpeer', () => {}) | ||
describe('.get', (done) => { | ||
it('errors when getting a non-existent key from the DHT', (done) => { | ||
ipfs.dht.get('non-existing', {timeout: '100ms'}, (err, value) => { | ||
expect(err).to.be.an.instanceof(Error) | ||
done() | ||
}) | ||
}) | ||
// belongs in put or integration | ||
it('puts and gets a key value pair in the DHT', (done) => { | ||
ipfs.dht.put('scope', 'interplanetary', (err, res) => { | ||
expect(err).to.not.exist | ||
|
||
expect(res).to.be.an('array') | ||
|
||
done() | ||
// bug: https://github.com/ipfs/go-ipfs/issues/1923#issuecomment-152932234 | ||
// apiClients.a.dht.get('scope', (err, value) => { | ||
// expect(err).to.not.exist | ||
// expect(value).to.be.equal('interplanetary') | ||
// done() | ||
// }) | ||
}) | ||
}) | ||
}) | ||
xdescribe('.put', () => {}) | ||
xdescribe('.query', () => {}) | ||
describe('.findprovs', () => { | ||
it('finds providers', (done) => { | ||
ipfs.dht.findprovs('Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP', (err, res) => { | ||
expect(err).to.not.exist | ||
|
||
expect(res).to.be.an('array') | ||
done() | ||
}) | ||
}) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters