import getModifiedProps from '../../src/utils/getModifiedProps';

describe('utils/getModifiedProps', () => {

  it('should return only modified props', () => {
    const prevProps = {
      firstProp: true,
      secondProp: true
    };

    const currProps = {
      firstProp: true,
      secondProp: false
    };

    const returnedProps = getModifiedProps(prevProps, currProps, false);
    expect(returnedProps).toEqual({ secondProp: false });

  });

  it('should return false for non modified props', () => {
    const prevProps = {
      firstProp: true,
      secondProp: true
    };

    const returnedProps = getModifiedProps(prevProps, prevProps, false);
    expect(returnedProps).toEqual(false);
  });

  it('should return modified props for undefined prevProps', () => {
    const prevProps = undefined;

    const currProps = {
      firstProp: true,
      secondProp: false
    };

    const returnedProps = getModifiedProps(prevProps, currProps, false);
    expect(returnedProps).toEqual(currProps);

  });

  it('should return modified props for null prevProps', () => {
    const prevProps = null;

    const currProps = {
      firstProp: true,
      secondProp: false
    };

    const returnedProps = getModifiedProps(prevProps, currProps, false);
    expect(returnedProps).toEqual(currProps);

  });
});


@@ -1315,13 +1315,594 @@
 %0A%0A  %7D);%0A
+  it('should not return text when children is not defined', () =%3E %7B%0A    const prevProps = null;%0A%0A    const currProps = %7B%0A      a: 1%0A    %7D;%0A%0A    const returnedProps = getModifiedProps(prevProps, currProps, true);%0A    expect(returnedProps.text).not.toBeDefined();%0A    expect(returnedProps.a).toBe(1);%0A  %7D);%0A%0A  it('should return text when children changes', () =%3E %7B%0A    const prevProps = %7B%7D;%0A%0A    const currProps = %7B%0A      children: %22teststring%22%0A    %7D;%0A%0A    const returnedProps = getModifiedProps(prevProps, currProps, true);%0A    expect(returnedProps.text).toBe(%22teststring%22);%0A  %7D);%0A%0A
 %7D);%0A%0A

Add some tests for getModifiedProps