title: Jest - testing eventChannel Redux-saga
body: <p>I have one sagas file with  2 functions, one is the saga itself, and the other is the function that is called by my saga, which uses the <code>eventChannel</code> from <code>redux-saga</code> library.</p>
  
  <pre><code>export const hardwareBackChannel = () =&gt; eventChannel((emit): {} =&gt; {
    BackHandler.addEventListener('hardwarePress', () =&gt; {
      emit(true);
      return true; 
    });
    return (): * =&gt; {
      BackHandler.removeEventListener();
    };
  });
  
  export function* handleBackButtonEvent() {
    yield put(hardwareBackChannel());
  }
  </code></pre>
  
  <p>I was able to test my <code>handleBackButtonEvent</code> successfully with: </p>
  
  <pre><code>  describe('handleBackButtonEvent', () =&gt; {
      it('should call back button pressed action', () =&gt; {
        testSaga(handleBackButtonEvent)
          .next()
          .put(
            hardwareBackChannel(),
          );
      });
    });
  </code></pre>
  
  <p>But I wasn't able to figure out how I can test the <code>hardwareBackChannel</code> itself using <code>testSaga</code>. Is there a way to do that? If not, how can I potentially cover this part of the code on my tests? </p>
  
  <p>I've trying to search all day but I found just threads with ways to test my saga, not my <code>hardwareBackChannel</code> function itself.</p>
  
  <p>Thanks advance</p>