Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
jsipfs swarm
Browse files Browse the repository at this point in the history
libp2p start and stop

not fail on browser tests. separate browser and node.js swarm tests
  • Loading branch information
daviddias committed Apr 12, 2016
1 parent d7b6654 commit 82a6ea5
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,15 @@ function IPFS (repo) {
libp2pNode.swarm.close(callback)
},
swarm: {
peers: () => {},
peers: (callback) => {
callback(null, [])
},
// all the addrs we know
addrs: notImpl,
localAddrs: notImpl,
connect: notImpl,
disconnect: notImpl,
filters: notImpl
filters: notImpl // TODO
},
routing: {},
records: {},
Expand Down
46 changes: 46 additions & 0 deletions src/http-api/routes/swarm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const resources = require('./../resources')

module.exports = (server) => {
const api = server.select('API')

api.route({
method: 'GET',
path: '/api/v0/swarm/addrs',
config: {
handler: resources.swarm.addrs.handler
}
})

api.route({
method: 'GET',
path: '/api/v0/swarm/addrs/local',
config: {
handler: resources.swarm.localAddrs.handler
}
})

api.route({
method: 'GET',
path: '/api/v0/swarm/connect',
config: {
handler: resources.swarm.connect
}
})

api.route({
method: 'GET',
path: '/api/v0/swarm/disconnect',
config: {
handler: resources.swarm.disconnect
}
})

// TODO
// api.route({
// method: 'GET',
// path: '/api/v0/swarm/filters',
// config: {
// handler: resources.swarm.disconnect
// }
// })
}
1 change: 0 additions & 1 deletion test/core-tests/test-bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const expect = require('chai').expect

process.env.IPFS_PATH = process.cwd() + '/tests/repo-example'
const IPFS = require('../../src/core')

describe('bootstrap', () => {
Expand Down
1 change: 0 additions & 1 deletion test/core-tests/test-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const expect = require('chai').expect

process.env.IPFS_PATH = process.cwd() + '/tests/repo-example'
const IPFS = require('../../src/core')

describe('id', () => {
Expand Down
1 change: 0 additions & 1 deletion test/core-tests/test-swarm-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const expect = require('chai').expect

process.env.IPFS_PATH = process.cwd() + '/tests/repo-example'
const IPFS = require('../../src/core')

describe('swarm', () => {
Expand Down
1 change: 0 additions & 1 deletion test/core-tests/test-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const expect = require('chai').expect

process.env.IPFS_PATH = process.cwd() + '/tests/repo-example'
const IPFS = require('../../src/core')

describe('version', () => {
Expand Down

0 comments on commit 82a6ea5

Please sign in to comment.