title: Angular Lazy loading module ,unit test code coverage
body: <p>How can I write unit test case for lazy loading Module</p>
  <pre><code>import { routes } from './app-routing';
  @NgModule({
      imports: [RouterModule.forRoot(routes)],
      exports: [RouterModule]
  })
  export class AppRoutingModule { }
  
  </code></pre>
  <p>route :export const routes: Routes = [
  {
  path: '',
  redirectTo: 'home',
  pathMatch: 'full'
  },
  {
  path: 'home',
  loadChildren: () =&gt; import('./home/home.module').then(m =&gt; m.HomeModule)
  },
  {
  path: 'qwe',
  loadChildren: () =&gt; import('./path2/qwe.module').then(m =&gt; m.Qwemodule)
  },
  {
  path: 'abc',
  loadChildren: () =&gt; import('./path1/abc.module').then(m =&gt; m.Abcmodule)
  }
  ];</p>
  <p>spec file:</p>
  <pre><code>describe('Routes', () =&gt; {
    it(`should load 4 Routes`, async(() =&gt; {
        console.log(routes.length.toString());
        var a=routes.length;
        expect(a).toEqual(4);
    }));
  });
  
  describe('Routes load child', () =&gt; {
    let location: Location;
    let router: Router;
    beforeEach(() =&gt; {
      TestBed.configureTestingModule({
          imports:[
            RouterTestingModule.withRoutes(routes),
            RouterTestingModule,
              HttpClientModule,
             HomeModule,
              Qwemodule,
              Abcmodule
            ],
          providers: [{provide: APP_BASE_HREF, useValue: '/'}]
      });
    });
  
    it(`navigate to route  /path loades module`, fakeAsync(() =&gt; {
      router = TestBed.get(Router);
      routes.forEach(route =&gt; {
        location = TestBed.get(Location);
        router.navigate([route.path]);
        tick(50);
       let t= route.loadChildren;
       expect(route.loadChildren).not.toBeNull;
       expect(location.path()).toBe('/'+route.path);
      });
     }));
  });
  
  </code></pre>
  <p>It lodes the router file covers in spc but in code coverage loadchild is not covered so it is 20% how to achieve 100% code coverage</p>