'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var chai_js = require('aegir/utils/chai.js');
var mocha = require('../utils/mocha.js');
var multiaddr = require('multiaddr');

function testList(factory, options) {
  const describe = mocha.getDescribe(options);
  const it = mocha.getIt(options);
  describe('.bootstrap.list', function () {
    this.timeout(100 * 1000);
    let ipfs;
    before(async () => {
      ipfs = (await factory.spawn()).api;
    });
    after(() => factory.clean());
    it('should return a list of peers', async () => {
      const res = await ipfs.bootstrap.list();
      const peers = res.Peers;
      chai_js.expect(peers).to.be.an('Array');
      chai_js.expect(peers.every(ma => multiaddr.Multiaddr.isMultiaddr(ma))).to.be.true();
    });
  });
}

exports.testList = testList;
