"use strict";

var _index = require("../../index");

describe('replacing schema value by processEnv from array to other data types', () => {
  const schema = {
    firstData: {
      cli: 'first',
      value: [1, 2, 'hi']
    }
  };
  const customOptions = {};
  it('to string', () => {
    const processEnv = {
      first: 'ONE'
    };
    const output = (0, _index.applyValuesToSchema)(schema, customOptions, processEnv);
    expect(output).toStrictEqual({
      firstData: 'ONE'
    });
  });
  it('to number', () => {
    const processEnv = {
      first: 28
    };
    const output = (0, _index.applyValuesToSchema)(schema, customOptions, processEnv);
    expect(output).toStrictEqual({
      firstData: 28
    });
  });
  it('to object', () => {
    const processEnv = {
      first: {
        hi: 'buddy'
      }
    };
    const output = (0, _index.applyValuesToSchema)(schema, customOptions, processEnv);
    expect(output).toStrictEqual({
      firstData: {
        hi: 'buddy'
      }
    });
  });
  it('to undefined', () => {
    const processEnv = {
      first: undefined
    };
    const output = (0, _index.applyValuesToSchema)(schema, customOptions, processEnv);
    expect(output).toStrictEqual({
      firstData: [1, 2, 'hi']
    });
  });
  it('to null', () => {
    const processEnv = {
      first: null
    };
    const output = (0, _index.applyValuesToSchema)(schema, customOptions, processEnv);
    expect(output).toStrictEqual({
      firstData: [1, 2, 'hi']
    });
  });
  it('to NaN', () => {
    const processEnv = {
      first: NaN
    };
    const output = (0, _index.applyValuesToSchema)(schema, customOptions, processEnv);
    expect(output).toStrictEqual({
      firstData: NaN
    });
  });
});