"use strict";

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

describe('replacing schema value by processEnv from undefined to other data types', () => {
  const schema = {
    firstData: {
      cli: 'first',
      value: undefined
    }
  };
  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 array', () => {
    const processEnv = {
      first: [1, 2, 3]
    };
    const output = (0, _index.applyValuesToSchema)(schema, customOptions, processEnv);
    expect(output).toStrictEqual({
      firstData: [1, 2, 3]
    });
  });
  it('to object', () => {
    const processEnv = {
      first: {
        hi: 'buddy'
      }
    };
    const output = (0, _index.applyValuesToSchema)(schema, customOptions, processEnv);
    expect(output).toStrictEqual({
      firstData: {
        hi: 'buddy'
      }
    });
  });
  it('to null', () => {
    const processEnv = {
      first: null
    };
    const output = (0, _index.applyValuesToSchema)(schema, customOptions, processEnv);
    expect(output).toStrictEqual({
      firstData: undefined
    });
  });
  it('to NaN', () => {
    const processEnv = {
      first: NaN
    };
    const output = (0, _index.applyValuesToSchema)(schema, customOptions, processEnv);
    expect(output).toStrictEqual({
      firstData: NaN
    });
  });
});
describe('replacing schema value by processEnv from null to other data types', () => {
  const schema = {
    firstData: {
      cli: 'first',
      value: null
    }
  };
  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('toC array', () => {
    const processEnv = {
      first: [1, 2, 3]
    };
    const output = (0, _index.applyValuesToSchema)(schema, customOptions, processEnv);
    expect(output).toStrictEqual({
      firstData: [1, 2, 3]
    });
  });
  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: null
    });
  });
  it('to NaN', () => {
    const processEnv = {
      first: NaN
    };
    const output = (0, _index.applyValuesToSchema)(schema, customOptions, processEnv);
    expect(output).toStrictEqual({
      firstData: NaN
    });
  });
});