'use strict';

var _chai;

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

var _sinon;

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

var _mergeVersion;

function _load_mergeVersion() {
  return _mergeVersion = require('../../../../src/consumer/versions-ops/merge-version');
}

var _consumerComponent;

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

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

describe('filesStatusWithoutSharedDir', function () {
  var sandbox = void 0;
  beforeEach(function () {
    sandbox = (_sinon || _load_sinon()).default.createSandbox();
  });
  afterEach(function () {
    sandbox.restore();
  });
  var originalFilesStatus = { 'bar/foo.js': 'updated' };
  var component = new (_consumerComponent || _load_consumerComponent()).default({
    name: 'foo',
    box: 'bar',
    version: '0.0.1',
    mainFile: 'bar/foo.js',
    scope: 'myScope'
  });
  var componentMap = {
    origin: 'IMPORTED'
  };
  it('should return the same filesStatus when there is no originallySharedDir', function () {
    sandbox.stub(component, 'setOriginallySharedDir').returns();
    var filesStatusResult = (0, (_mergeVersion || _load_mergeVersion()).filesStatusWithoutSharedDir)(originalFilesStatus, component, componentMap);
    (0, (_chai || _load_chai()).expect)(filesStatusResult).to.deep.equal(originalFilesStatus);
  });
  it('should return the filesStatus without the sharedDir when there the originallySharedDir is set and is IMPORTED', function () {
    sandbox.stub(component, 'setOriginallySharedDir').returns();
    component.originallySharedDir = 'bar';
    var filesStatusResult = (0, (_mergeVersion || _load_mergeVersion()).filesStatusWithoutSharedDir)(originalFilesStatus, component, componentMap);
    (0, (_chai || _load_chai()).expect)(filesStatusResult).to.deep.equal({ 'foo.js': 'updated' });
  });
  it('should return the same filesStatus when there the originallySharedDir is set and is AUTHORED', function () {
    sandbox.stub(component, 'setOriginallySharedDir').returns();
    component.originallySharedDir = 'bar';
    componentMap.origin = 'AUTHORED';
    var filesStatusResult = (0, (_mergeVersion || _load_mergeVersion()).filesStatusWithoutSharedDir)(originalFilesStatus, component, componentMap);
    (0, (_chai || _load_chai()).expect)(filesStatusResult).to.deep.equal(originalFilesStatus);
  });
});