'use strict';

var _chai;

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

var _migrationHelper;

function _load_migrationHelper() {
  return _migrationHelper = _interopRequireDefault(require('../../src/migration/migration-helper'));
}

var _logger;

function _load_logger() {
  return _logger = _interopRequireDefault(require('../../src/logger/logger'));
}

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

describe('migration helper', function () {
  var migrationVersions = void 0;
  var versionsNumbers = void 0;
  (_logger || _load_logger()).default.debug = function () {};
  before(function () {
    var storeVersion = '0.0.3';
    var bitVersion = '0.0.6';
    var migratonManifest = {
      '0.0.5': {
        Version: []
      },
      '0.0.3': {
        Version: []
      },
      '0.0.4': {
        Version: []
      },
      '0.0.6': {
        Version: []
      },
      '0.0.7': {
        Version: []
      }
    };
    migrationVersions = (0, (_migrationHelper || _load_migrationHelper()).default)(bitVersion, storeVersion, migratonManifest);
    versionsNumbers = migrationVersions.map(function (migrationVersion) {
      return Object.keys(migrationVersion)[0];
    });
  });
  it('should sort the version in ascending order', function () {
    (0, (_chai || _load_chai()).expect)(versionsNumbers).include.ordered.members(['0.0.4', '0.0.5', '0.0.6']);
  });
  it('should filter versions below the store version', function () {
    (0, (_chai || _load_chai()).expect)(versionsNumbers).to.not.include('0.0.3');
  });
  it('should filter versions above the current version', function () {
    (0, (_chai || _load_chai()).expect)(versionsNumbers).to.not.include('0.0.7');
  });
});