'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _homeDir = require('home-dir');

var _homeDir2 = _interopRequireDefault(_homeDir);

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

const utils = {
  returnTestGlobals() {
    return {
      email: process.env.E2E_CLI_EMAIL,
      password: process.env.E2E_CLI_PASSWORD,
      accountKey: process.env.E2E_CLI_ACCOUNT_KEY,
      syncanoYmlPath: `${(0, _homeDir2.default)()}/syncano-test.yml`,
      instance: process.env.E2E_CLI_INSTANCE_NAME || 'wandering-pine-7032'
    };
  },

  splitTestBaseEmail(tempEmail) {
    const splittedEmail = {};

    [splittedEmail.emailName, splittedEmail.emailDomain] = tempEmail.split('@');

    return splittedEmail;
  },

  createTempEmail(tempEmail, tempPass) {
    const { emailName, emailDomain } = this.splitTestBaseEmail(tempEmail);

    return `${emailName}+${tempPass}@${emailDomain}`;
  },

  getRandomString(prefix = 'randomString') {
    return `${prefix}_${Math.random().toString(36).slice(2)}`;
  },

  assignTestRegistryEnv() {
    const registryInstanceName = process.env.SYNCANO_SOCKET_REGISTRY;
    process.env.SYNCANO_SOCKET_REGISTRY_INSTANCE = registryInstanceName.split('.')[0];
  },

  removeTestRegistryEnv() {
    delete process.env.SYNCANO_SOCKET_REGISTRY_INSTANCE;
  }
};

exports.default = utils;
module.exports = exports['default'];
//# sourceMappingURL=test-utils.js.map