import { expect } from 'aegir/utils/chai.js';
import {
  getDescribe,
  getIt
} from '../utils/mocha.js';
export function testStop(factory, options) {
  const describe = getDescribe(options);
  const it = 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 expect(ipfs.swarm.peers()).to.eventually.be.rejected();
    });
  });
}