'use strict';

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

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

function testState(factory, options) {
  const describe = mocha.getDescribe(options);
  const it = mocha.getIt(options);
  describe('.name.pubsub.state', () => {
    let ipfs;
    before(async () => {
      ipfs = (await factory.spawn()).api;
    });
    after(() => factory.clean());
    it('should get the current state of pubsub', async function () {
      this.timeout(50 * 1000);
      const res = await ipfs.name.pubsub.state();
      chai_js.expect(res).to.exist();
      chai_js.expect(res).to.have.property('enabled');
      chai_js.expect(res.enabled).to.be.eql(true);
    });
  });
}

exports.testState = testState;
