Angular 8 Tutorial
https://www.youtube.com/watch?v=n6TDWpJ-qjs&list=PL5Agzt13Z4g_AVsqkZtsykXZPLcA40jVC
SpyNgModuleFactoryLoader Doesn't work anymore in angular 13/14 since NgModuleFactoryLoader is deprecated and removed from Agular .
Replace SpyNgModuleFactoryLoader with NgModule
we can use ngModule instead of it like below
it('Lazy loading test case', fakeAsync(() = {
const lazyloder = TestBed.inject(NgModule);
lazyloder.stubbedModules = {lazymodule:LazyModule};
objRouter.navigateByUrl('/employeelist');
tick();
fixture.detectChanges();
expect(location.path()).toBe('/employeelist');
}));
you can see the source code for the same in the below link (search for 37)
https://github.com/TheDotNetOffice/Angular-Unit-test-UsiingJsminKarma
http://www.dotnetoffice.com/
Support Us
https://www.buymeacoffee.com/theDotNetOffice : Buy me a Book
Support: https://www.paypal.com/paypalme/theDotNetOffice
Facebook: https://www.facebook.com/TheDotNetOffice
Twitter: https://twitter.com/thedotnetoffice
#AngularLazyLoading #angularunittest #Jasmine
Download
0 formats
No download links available.
Part 37 -Angular Unit test case on lazy loading | Angular unit test case Tutorials in Jasmine& Karma | NatokHD