'use strict';

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

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

function testStop(factory, options) {
  const describe = mocha.getDescribe(options);
  const it = mocha.getIt(options);
  describe('.stop', function () {
    this.timeout(60 * 1000);
    let ipfs;
    beforeEach(async () => {
      ipfs = (await factory.spawn()).api;
    });
    afterEach(() => {
      factory.controllers = [];
    });
    it('should stop the node', async () => {
      await ipfs.swarm.peers();
      await ipfs.stop();
      return chai_js.expect(ipfs.swarm.peers()).to.eventually.be.rejected();
    });
  });
}

exports.testStop = testStop;
