title: testing redux-saga inside if statement and using real values
body: <p>How do I test a function inside an if statement or try/catch? For instance,</p>
  
  <pre><code>export function* onFetchMessages(channel) {
      yield put(requestMessages())
      const channel_name = channel.payload
      try {
          const response = yield call(fetch,'/api/messages/'+channel_name)
  
          if(response.ok){
              const res = yield response.json();
  
              const date = moment().format('lll');
              yield put(receiveMessages(res,channel.payload,date))
          }
  
  
      } catch (error){
          yield put(rejectMessages(error))
      }
  }
  </code></pre>
  
  <p>I need to input a real channel name that actually exist in the database for it to return a valid response for the yields that follow to execute, otherwise it will throw an error. In addition, I will get an error message, cannot read property json of undefined, so the yield after that cannot be reached due to this error message.
  So my first problem is 'if(response.ok)' but even if I remove it, yield response.json() would return an error and in addition the yield after that wont be executed.
  If anyone can show me how to test these, would be much appreciated.</p>