'use strict';

var _chai;

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

var _versionParser;

function _load_versionParser() {
  return _versionParser = _interopRequireDefault(require('../../src/version/version-parser'));
}

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

describe('versionParser()', function () {
  it('should return latest version representation', function () {
    var version = (0, (_versionParser || _load_versionParser()).default)('latest');
    (0, (_chai || _load_chai()).expect)(version.latest).to.equal(true);
    (0, (_chai || _load_chai()).expect)(version.versionNum).to.equal(null);
  });

  it('should throw invalid version', function () {
    var version = (0, (_versionParser || _load_versionParser()).default)('latest');
    (0, (_chai || _load_chai()).expect)(function () {
      version('$1');
    }).to.throw();
  });

  it('should return a concrete version', function () {
    var version = (0, (_versionParser || _load_versionParser()).default)('0.0.1');
    (0, (_chai || _load_chai()).expect)(version.latest).to.equal(false);
    (0, (_chai || _load_chai()).expect)(version.versionNum).to.equal('0.0.1');
  });

  it('should return a latest tested version', function () {
    var version = (0, (_versionParser || _load_versionParser()).default)('*0.0.1');
    (0, (_chai || _load_chai()).expect)(version.latest).to.equal(true);
    (0, (_chai || _load_chai()).expect)(version.versionNum).to.equal('0.0.1');
  });

  it('should return a latest tested version with double digits', function () {
    var version = (0, (_versionParser || _load_versionParser()).default)('*0.0.11');
    (0, (_chai || _load_chai()).expect)(version.latest).to.equal(true);
    (0, (_chai || _load_chai()).expect)(version.versionNum).to.equal('0.0.11');
  });
});