'use strict';

var _chai;

function _load_chai() {
  return _chai = require('chai');
}

var _sinon;

function _load_sinon() {
  return _sinon = _interopRequireDefault(require('sinon'));
}

var _consumer;

function _load_consumer() {
  return _consumer = _interopRequireDefault(require('../../src/consumer/consumer'));
}

var _consumerComponent;

function _load_consumerComponent() {
  return _consumerComponent = _interopRequireDefault(require('../../src/consumer/component/consumer-component'));
}

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// Skipping this, should be deleted after writing appropriate tests for the virtualizaion
describe.skip('Consumer', function () {
  describe('runAllInlineSpecs', function () {
    var sandbox = void 0;
    beforeEach(function () {
      sandbox = (_sinon || _load_sinon()).default.createSandbox();
    });
    afterEach(function () {
      sandbox.restore();
    });
    it('should return an empty array if there are no inline components', function () {
      sandbox.stub((_consumer || _load_consumer()).default.prototype, 'listInline').returns(Promise.resolve([]));
      var consumer = new (_consumer || _load_consumer()).default({ projectPath: '' });
      var result = consumer.runAllInlineSpecs();
      return result.then(function (data) {
        (0, (_chai || _load_chai()).expect)(data).to.be.an('Array');
        (0, (_chai || _load_chai()).expect)(data.length).to.be.equal(0);
      });
    });
    it('should return an array with results for all inline components', function () {
      var consumerComponent1 = new (_consumerComponent || _load_consumerComponent()).default({ name: 'component-name1', box: 'box' });
      var consumerComponent2 = new (_consumerComponent || _load_consumerComponent()).default({ name: 'component-name2', box: 'box' });
      sandbox.stub((_consumer || _load_consumer()).default.prototype, 'listInline').returns(Promise.resolve([consumerComponent1, consumerComponent2]));

      var consumer = new (_consumer || _load_consumer()).default({ projectPath: '' });
      var result = consumer.runAllInlineSpecs();
      (0, (_chai || _load_chai()).expect)(result).to.be.a('Promise');
      return result.then(function (data) {
        (0, (_chai || _load_chai()).expect)(data).to.be.an('Array');
        (0, (_chai || _load_chai()).expect)(data.length).to.be.equal(2);
        data.map(function (resultData) {
          return (0, (_chai || _load_chai()).expect)(resultData).to.have.all.keys('specs', 'component');
        });
      });
    });
  });
});