title: Kotlin Flow: emitAll is never collected
body: <p>I am trying to write a UnitTest for the kotlin-version of <code>networkBoundResource</code> that can be found on <a href="https://stackoverflow.com/a/58583081/990129">serveral sources</a> with <a href="https://stackoverflow.com/a/65984833/990129">several features</a></p>
  <p>Here is my version of it with marker-comments for the following question.</p>
  <pre><code>inline fun &lt;ResultType, RequestType&gt; networkBoundResource(
      ...
      coroutineDispatcher: CoroutineDispatcher
  ) = flow {
  
      emit(Resource.loading(null)) // emit works!
  
      val data = queryDatabase().firstOrNull()
  
      val flow = if (shouldFetch(data)) {
          
          emit(Resource.loading(data)) // emit works!
  
          try {
              saveFetchResult(fetch())
              query().map { Resource.success(it) }
              
          } catch (throwable: Throwable) {
              onFetchFailed(throwable)
              query().map { Resource.error(throwable.toString(), it) }
              
          }
      } else {
          query().map { Resource.success(it) }
      }
  
      emitAll(flow) // emitAll does not work!
  
  }.catch { exception -&gt;
      emit(Resource.error(&quot;An error occurred while fetching data! $exception&quot;, null))
  
  }.flowOn(coroutineDispatcher)
  </code></pre>
  <p>This is one of my UnitTests for this code. The code is edited a bit to focus on my question:</p>
  <pre><code>
  @get:Rule
  val testCoroutineRule = TestCoroutineRule()
  
  private val coroutineDispatcher = TestCoroutineDispatcher()
  
  @Test
  fun networkBoundResource_noCachedData_shouldMakeNetworkCallAndStoreUserInDatabase() = testCoroutineRule.runBlockingTest {
      ...
  
      // When getAuthToken is called
      val result = networkBoundResource(..., coroutineDispatcher).toList()
  
      result.forEach {
          println(it)
      }    
  }
  </code></pre>
  <p>The problem is that <code>println(it)</code> is only printing the <code>Resource.loading(null)</code> emissions. But if you have a look at the last line of the <code>flow {}</code> block, you will see that there should be another emission of the <code>val flow</code>. But this emission never arrives in my UnitTest. Why?</p>