"use strict";

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

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

  _chai = function () {
    return data;
  };

  return data;
}

function _migrationHelper() {
  const data = _interopRequireDefault(require("../migration/migration-helper"));

  _migrationHelper = function () {
    return data;
  };

  return data;
}

function _logger() {
  const data = _interopRequireDefault(require("../logger/logger"));

  _logger = function () {
    return data;
  };

  return data;
}

describe('migration helper', () => {
  let migrationVersions;
  let versionsNumbers;

  _logger().default.debug = () => {};

  before(() => {
    const storeVersion = '0.0.3';
    const bitVersion = '0.0.6';
    const migratonManifest = {
      '0.0.5': {
        Version: []
      },
      '0.0.3': {
        Version: []
      },
      '0.0.4': {
        Version: []
      },
      '0.0.6': {
        Version: []
      },
      '0.0.7': {
        Version: []
      }
    };
    migrationVersions = (0, _migrationHelper().default)(bitVersion, storeVersion, migratonManifest);
    versionsNumbers = migrationVersions.map(migrationVersion => Object.keys(migrationVersion)[0]);
  });
  it('should sort the version in ascending order', () => {
    (0, _chai().expect)(versionsNumbers).include.ordered.members(['0.0.4', '0.0.5', '0.0.6']);
  });
  it('should filter versions below the store version', () => {
    (0, _chai().expect)(versionsNumbers).to.not.include('0.0.3');
  });
  it('should filter versions above the current version', () => {
    (0, _chai().expect)(versionsNumbers).to.not.include('0.0.7');
  });
});