'use strict';

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

var chai_js = require('aegir/utils/chai.js');
var mocha = require('../utils/mocha.js');
var all = require('it-all');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var all__default = /*#__PURE__*/_interopDefaultLegacy(all);

function testDisabled(factory, options) {
  const describe = mocha.getDescribe(options);
  const it = mocha.getIt(options);
  describe('disabled', function () {
    this.timeout(80 * 1000);
    let nodeA;
    let nodeB;
    before(async () => {
      nodeA = (await factory.spawn({ ipfsOptions: { config: { Routing: { Type: 'none' } } } })).api;
      nodeB = (await factory.spawn()).api;
      const nodeBId = await nodeB.id();
      await nodeA.swarm.connect(nodeBId.addresses[0]);
    });
    after(() => factory.clean());
    it('should error when DHT not available', async () => {
      const events = await all__default["default"](nodeA.dht.get('/ipns/12D3KooWQMSMXmsBvs5YDEQ6tXsaFv9tjuzmDmEvusaiQSFdrJdN'));
      chai_js.expect(events.filter(event => event.name === 'QUERY_ERROR')).to.not.be.empty();
    });
  });
}

exports.testDisabled = testDisabled;
