<commit_before>import { mergeProps } from '../../src/HOFs/propMerger'

describe('mergeProps()', () => {
  it('should merge the `src` object into the `destination` object', () => {
    const src = { width: 100, height: 200, imgixParams: {ar: "1:2", dpr: 2} }
    const destination = { }
    const result = mergeProps(src, destination);

    expect(result).toEqual(
      { width: 100, height: 200, imgixParams: { ar: "1:2", dpr: 2 } }
    )
  })

  it('should not overwrite destination values with source values', () => {
    const src = { width: 100, height: 200, imgixParams: {ar: "1:2", dpr: 2} }
    const destination = { width: 101 }
    const result = mergeProps(src, destination);

    expect(result).toEqual(
      { width: 101, height: 200, imgixParams: { ar: "1:2", dpr: 2 } }
    )
  })

  it('should overwrite destination that resolves to `null` if source exists',
    () => {
      const src = { width: 100, height: 200, imgixParams: { ar: "1:1" } }
      const destination = { width: 101, height: null, imgixParams: { rot: 90 } }
      const result = mergeProps(src, destination);

      expect(result).toEqual(
        { width: 101, height: 200, imgixParams: { ar: "1:1", rot: 90 } }
      );
    }
  )

  it('should recursively merge imgixParams and htmlAttributes',
    () => {
      const src = {
        width: 100,
        height: 200,
        imgixParams: { ar: "1:2", dpr: 2},
        htmlAttributes: { styles: "width: 50" }
      }
      const destination = {
        width: 101,
        height: 201,
        imgixParams: { dpr: 1 },
        htmlAttributes: { styles: "width: 100" }
      }
      const result = mergeProps(src, destination);

      expect(result).toEqual(
        {
          width: 101,
          height: 201,
          imgixParams: { ar: "1:2", dpr: 1 },
          htmlAttributes: { styles: "width: 100" }
        }
      );
    }
  )<commit_msg>chore: add more edge cases to test<commit_after>import { mergeProps } from '../../src/HOFs/propMerger'

describe('mergeProps()', () => {
  it('should merge the `src` object into the `destination` object', () => {
    const src = { width: 100, height: 200, imgixParams: {ar: "1:2", dpr: 2} }
    const destination = { }
    const result = mergeProps(src, destination);

    expect(result).toEqual(
      { width: 100, height: 200, imgixParams: { ar: "1:2", dpr: 2 } }
    )
  })

  it('should not overwrite destination values with source values', () => {
    const src = { width: 100, height: 200, imgixParams: {ar: "1:2", dpr: 2} }
    const destination = { width: 101 }
    const result = mergeProps(src, destination);

    expect(result).toEqual(
      { width: 101, height: 200, imgixParams: { ar: "1:2", dpr: 2 } }
    )
  })

  it('should overwrite destination that resolves to `null` if source exists',
    () => {
      const src = { width: 100, height: 200, imgixParams: { ar: "1:1" } }
      const destination = { width: 101, height: null, imgixParams: { rot: 90 } }
      const result = mergeProps(src, destination);

      expect(result).toEqual(
        { width: 101, height: 200, imgixParams: { ar: "1:1", rot: 90 } }
      );
    }
  )

  it('should recursively merge imgixParams and htmlAttributes',
    () => {
      const src = {
        imgixParams: { ar: "1:2", dpr: 2},
        htmlAttributes: { styles: "width: 50", alt: "src" }
      }
      const destination = {
        imgixParams: { dpr: 1, fit: "fill" },
        htmlAttributes: { styles: "width: 100", className: "destination" }
      }
      const result = mergeProps(src, destination);

      expect(result).toEqual(
        {
          imgixParams: { ar: "1:2", dpr: 1, fit: "fill" },
          htmlAttributes: { styles: "width: 100", className: "destination", alt: "src" }
        }
      );
    }
  )
{'fraction_non_alphanumeric': 0.15888594164456232, 'fraction_numerical': 0.04562334217506631, 'mean_word_length': 2.5144454799627214, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4485282', 'n_tokens_mistral': 1359, 'n_tokens_neox': 1207, 'n_words': 350}