"use strict";

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

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