This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
3 changed files
with
49 additions
and
2 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
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
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,45 @@ | ||
/* eslint-env mocha */ | ||
'use strict' | ||
|
||
const chai = require('chai') | ||
const dirtyChai = require('dirty-chai') | ||
const expect = chai.expect | ||
chai.use(dirtyChai) | ||
const IPFS = require('..') | ||
const list = require('../src/core/runtime/config-browser.json').Bootstrap | ||
|
||
/* | ||
* These tests were graciously made for lgierth, so that he can test the | ||
* WebSockets Bootstrappers easily <3 | ||
*/ | ||
describe('Check that a js-ipfs node can indeed contact the bootstrappers', function () { | ||
this.timeout(60 * 1000) | ||
|
||
it('a node connects to bootstrapers', (done) => { | ||
const node = new IPFS({ | ||
config: { | ||
Addresses: { | ||
Swarm: [] | ||
} | ||
} | ||
}) | ||
|
||
node.on('ready', check) | ||
|
||
function check () { | ||
node.swarm.peers((err, peers) => { | ||
expect(err).to.not.exist() | ||
|
||
if (peers.length !== list.length) { | ||
return setTimeout(check, 2000) | ||
} | ||
|
||
const peerList = peers.map((peer) => peer.addr.toString()) | ||
expect(peers.length).to.equal(list.length) | ||
expect(peerList).to.eql(list) | ||
|
||
node.stop(done) | ||
}) | ||
} | ||
}) | ||
}) |