text: var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _reactNative=require("react-native");var _index=_interopRequireDefault(require("../index"));describe('react-native-netinfo',function(){describe('Event listener management',function(){beforeEach(function(){_index.default.clearEventListeners();_reactNative.NativeModules.RNCNetInfo.getCurrentConnectivity.mockResolvedValue({type:'cellular',effectiveType:'3g'});});it('should add the listener to the native module when passing the correct event name',function(){_index.default.addEventListener('connectionChange',jest.fn());expect(_reactNative.NativeModules.RNCNetInfo.addListener).toBeCalledWith(_index.default.Events.NetworkStatusDidChange);});it('should do nothing when passing the wrong event name',function(){_index.default.addEventListener('WRONGNAME',jest.fn());expect(_reactNative.NativeModules.RNCNetInfo.addListener).not.toBeCalled();});it('should not error when calling remove on an invalid subscription',function(){var subscription=_index.default.addEventListener('WRONGNAME',jest.fn());subscription.remove();expect(_reactNative.NativeModules.RNCNetInfo.addListener).not.toBeCalled();});it('should remove the listener from the native module when calling removeEventListener',function(){var listener=jest.fn();_index.default.addEventListener('connectionChange',listener);_index.default.removeEventListener('connectionChange',listener);expect(_reactNative.NativeModules.RNCNetInfo.removeListeners).toBeCalled();});it('should not call the native module if asked to remove a listener which was never added',function(){_index.default.removeEventListener('connectionChange',jest.fn());expect(_reactNative.NativeModules.RNCNetInfo.removeListeners).not.toBeCalled();});it('should remove the listener from the native module when calling remove on the returned subscription',function(){var listener=jest.fn();var subscription=_index.default.addEventListener('connectionChange',listener);subscription.remove();expect(_reactNative.NativeModules.RNCNetInfo.removeListeners).toBeCalled();});});});
  //# sourceMappingURL=eventListenerManagement.js.map