|
1 | 1 | /* eslint-env mocha */
|
2 | 2 |
|
3 |
| -// const expect = require('chai').expect |
| 3 | +const expect = require('chai').expect |
| 4 | +const APIctl = require('ipfs-api') |
4 | 5 |
|
5 | 6 | describe('bootstrap', () => {
|
6 | 7 | describe('api', () => {
|
7 |
| - // var api |
| 8 | + var api |
8 | 9 |
|
9 |
| - it.skip('api', (done) => { |
10 |
| - // api = require('../../src/http-api').server.select('API') |
| 10 | + it('api', (done) => { |
| 11 | + api = require('../../src/http-api').server.select('API') |
11 | 12 | done()
|
12 | 13 | })
|
13 | 14 |
|
14 |
| - // TODO |
| 15 | + it('list', (done) => { |
| 16 | + api.inject({ |
| 17 | + method: 'GET', |
| 18 | + url: '/api/v0/bootstrap' |
| 19 | + }, (res) => { |
| 20 | + expect(res.result).to.deep.equal(defaultList) |
| 21 | + done() |
| 22 | + }) |
| 23 | + }) |
| 24 | + |
| 25 | + it('list 2', (done) => { |
| 26 | + api.inject({ |
| 27 | + method: 'GET', |
| 28 | + url: '/api/v0/bootstrap/list' |
| 29 | + }, (res) => { |
| 30 | + expect(res.result).to.deep.equal(defaultList) |
| 31 | + done() |
| 32 | + }) |
| 33 | + }) |
| 34 | + |
| 35 | + it('add', (done) => { |
| 36 | + api.inject({ |
| 37 | + method: 'GET', |
| 38 | + url: '/api/v0/bootstrap/add', |
| 39 | + payload: { |
| 40 | + arg: '/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT' |
| 41 | + } |
| 42 | + }, (res) => { |
| 43 | + done() |
| 44 | + }) |
| 45 | + }) |
| 46 | + |
| 47 | + it('rm', (done) => { |
| 48 | + api.inject({ |
| 49 | + method: 'GET', |
| 50 | + url: '/api/v0/bootstrap/rm', |
| 51 | + payload: { |
| 52 | + arg: '/ip4/111.111.111.111/tcp/1001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLUVIT' |
| 53 | + } |
| 54 | + }, (res) => { |
| 55 | + done() |
| 56 | + }) |
| 57 | + }) |
| 58 | + |
| 59 | + it('confirm list is as expected', (done) => { |
| 60 | + api.inject({ |
| 61 | + method: 'GET', |
| 62 | + url: '/api/v0/bootstrap/list' |
| 63 | + }, (res) => { |
| 64 | + expect(res.result).to.deep.equal(defaultList) |
| 65 | + done() |
| 66 | + }) |
| 67 | + }) |
15 | 68 | })
|
16 | 69 |
|
17 | 70 | describe('gateway', () => {})
|
18 | 71 |
|
19 | 72 | describe('using js-ipfs-api', () => {
|
20 |
| - // TODO |
| 73 | + var ctl |
| 74 | + |
| 75 | + it('start IPFS API ctl', (done) => { |
| 76 | + ctl = APIctl('/ip4/127.0.0.1/tcp/6001') |
| 77 | + done() |
| 78 | + }) |
| 79 | + |
| 80 | + // TODO: needs https://github.com/ipfs/js-ipfs-api/issues/217 |
| 81 | + it.skip('list', (done) => { |
| 82 | + ctl.boostrap.list((err, result) => { |
| 83 | + expect(err).to.not.exist |
| 84 | + expect(result).to.deep.equal(defaultList) |
| 85 | + done() |
| 86 | + }) |
| 87 | + }) |
| 88 | + |
| 89 | + it.skip('add', (done) => {}) |
| 90 | + it.skip('rm', (done) => {}) |
21 | 91 | })
|
22 | 92 | })
|
| 93 | + |
| 94 | +const defaultList = [ |
| 95 | + '/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ', |
| 96 | + '/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z', |
| 97 | + '/ip4/104.236.179.241/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM', |
| 98 | + '/ip4/162.243.248.213/tcp/4001/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm', |
| 99 | + '/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu', |
| 100 | + '/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64', |
| 101 | + '/ip4/178.62.158.247/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd', |
| 102 | + '/ip4/178.62.61.185/tcp/4001/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3', |
| 103 | + '/ip4/104.236.151.122/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx' |
| 104 | +] |
0 commit comments