title: APP_INITIALIZER failing test cases
body: <p>I am using APP_INITIALIZER to make some API calls, everything is working fine but adding </p>
  
  <pre><code> { provide: APP_INITIALIZER, useFactory: MyProviderFactory, deps: [MyService], multi: true }
  </code></pre>
  
  <p>in app.module.ts failing my test cases.
  Here is my app.module.ts file</p>
  
  <pre><code>import { BrowserModule } from '@angular/platform-browser';
  import { NgModule, APP_INITIALIZER } from '@angular/core';
  import { RouterModule } from '@angular/router';
  import { HttpClientModule } from '@angular/common/http';
  import { LayoutModule } from '@angular/cdk/layout';
  
  import { AppComponent } from './app.component';
  
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
  // tslint:disable-next-line:max-line-length
  
  import { MyService } from './services/my-provider.service';
  
  export function MyProviderFactory(provider: MyService) {
    return () =&gt; provider.getdata();
  }
  
  
  @NgModule({
    declarations: [
      AppComponent,
    ],
    imports: [
      BrowserModule,
      HttpClientModule,
      FormsModule,
      BrowserAnimationsModule,
      HttpClientModule,
      ReactiveFormsModule,
      RouterModule.forRoot([
        { path: '', component: AppComponent }
      ])
    ],
    providers: [ MyService,
                { provide: APP_INITIALIZER, useFactory: MyProviderFactory, deps: [MyService], multi: true }
              ],
    bootstrap: [AppComponent]
  })
  export class AppModule { }
  
  </code></pre>
  
  <p>Here is the error</p>
  
  <pre><code>"message": "An error was thrown in afterAll\nFailed: You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
  </code></pre>
  
  <p>Also how to test APP_INITIALIZER in the app.</p>
  
  <p>Any help would be appreciated.</p>