import React from 'react';
import { mount } from 'enzyme';

import { MapInteraction } from '../MapInteraction';

describe('MapInteraction', () => {
  it('should call this.setPointerState() if newTranslation and newScale changed', () => {
    const handleChange = jest.fn();

    const currentProps = {
      transform: { scale: 0, x: 0, y: 0 },
      onChange: handleChange,
    };
    const newProps = {
      ...currentProps,
      transform: { scale: 1, x: 1, y: 1 },
    };

    const component = mount(
      <MapInteraction {...currentProps}>
        <div />
      </MapInteraction>
    );

    component.setProps(newProps);

    expect(handleChange).toHaveBeenCalled();
  });
});
