'use strict';

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

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

function testReplace(factory, options) {
  const describe = mocha.getDescribe(options);
  const it = mocha.getIt(options);
  describe('.config.replace', function () {
    this.timeout(30 * 1000);
    let ipfs;
    before(async () => {
      ipfs = (await factory.spawn()).api;
    });
    after(() => factory.clean());
    const config = { Addresses: { API: '' } };
    it('should replace the whole config', async () => {
      await ipfs.config.replace(config);
      const _config = await ipfs.config.getAll();
      chai_js.expect(_config).to.deep.equal(config);
    });
    it('should replace to empty config', async () => {
      await ipfs.config.replace({});
      const _config = await ipfs.config.getAll();
      chai_js.expect(_config).to.deep.equal({});
    });
  });
}

exports.testReplace = testReplace;
