"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

function _chai() {
  const data = require("chai");

  _chai = function () {
    return data;
  };

  return data;
}

function _versionParser() {
  const data = _interopRequireDefault(require("../version/version-parser"));

  _versionParser = function () {
    return data;
  };

  return data;
}

describe('versionParser()', () => {
  it('should return latest version representation', () => {
    const version = (0, _versionParser().default)('latest');
    (0, _chai().expect)(version.latest).to.equal(true);
    (0, _chai().expect)(version.versionNum).to.equal(null);
  });
  it('should throw invalid version', () => {
    const version = (0, _versionParser().default)('latest');
    (0, _chai().expect)(() => {
      version('$1');
    }).to.throw();
  });
  it('should return a concrete version', () => {
    const version = (0, _versionParser().default)('0.0.1');
    (0, _chai().expect)(version.latest).to.equal(false);
    (0, _chai().expect)(version.versionNum).to.equal('0.0.1');
  });
  it('should return a latest tested version', () => {
    const version = (0, _versionParser().default)('*0.0.1');
    (0, _chai().expect)(version.latest).to.equal(true);
    (0, _chai().expect)(version.versionNum).to.equal('0.0.1');
  });
  it('should return a latest tested version with double digits', () => {
    const version = (0, _versionParser().default)('*0.0.11');
    (0, _chai().expect)(version.latest).to.equal(true);
    (0, _chai().expect)(version.versionNum).to.equal('0.0.11');
  });
  it('should parse given version as latest', () => {
    const version = (0, _versionParser().default)('latest');
    (0, _chai().expect)(version.versionNum).to.equal(null);
    (0, _chai().expect)(version.latest).to.equal(true);
  });
});