react-native/jest
Emmanouil Konstantinidis 5121434262 Mock Linking - openURL & canOpenURL
Summary:
This PR brings 2 basic mocks for `Linking`'s `openURL` & `canOpenURL` methods. Below you can find 2 examples on how to it works.

```javascript

  it('presses the open website button', () => {
    const wrapper = shallow(<Info />);

    expect(wrapper).toBeDefined();

    wrapper.find('TouchableOpacity').simulate('press');

    expect(Linking.openURL).toHaveBeenCalledTimes(1);
    expect(Linking.openURL).toHaveBeenCalledWith('https://www.hello.world/');
  });

  it('presses the call button', () => {
    const wrapper = shallow(<MoreInfo />);

    expect(wrapper).toBeDefined();

    wrapper.find('TouchableOpacity').simulate('press');

    expect(Linking.canOpenURL).toHaveBeenCalledTimes(1);
    expect(Linking.canOpenURL).toHaveBeenCalledWith('tel:01273123123');
  });
````
Closes https://github.com/facebook/react-native/pull/12839

Differential Revision: D4908903

Pulled By: javache

fbshipit-source-id: 0b62e9c2a7f920dc8bf0a49c1973f65c473eb653
2017-04-19 04:20:12 -07:00
..
mockComponent.js RN: Cleanup OSS JS & Flow Declarations 2016-11-20 17:58:29 -08:00
preprocessor.js Fix incorrect line numbers in test failures 2017-02-22 06:51:15 -08:00
setup.js Mock Linking - openURL & canOpenURL 2017-04-19 04:20:12 -07:00