'use strict';

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

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

function testVersion(factory, options) {
  const describe = mocha.getDescribe(options);
  const it = mocha.getIt(options);
  describe('.version', () => {
    let ipfs;
    before(async () => {
      ipfs = (await factory.spawn()).api;
    });
    after(() => factory.clean());
    it('should get the node version', async () => {
      const result = await ipfs.version();
      chai_js.expect(result).to.have.a.property('version');
      chai_js.expect(result).to.have.a.property('commit');
      chai_js.expect(result).to.have.a.property('repo');
    });
    it('should include the ipfs-http-client version', async () => {
      const result = await ipfs.version();
      chai_js.expect(result).to.have.a.property('ipfs-http-client');
    });
    it('should include the interface-ipfs-core version', async () => {
      const result = await ipfs.version();
      chai_js.expect(result).to.have.a.property('interface-ipfs-core');
    });
  });
}

exports.testVersion = testVersion;
