What it does
Sets up the router to be used for testing.
How to use
Class Overview
Class Description
The modules sets up the router to be used for testing.
It provides spy implementations of Location
, LocationStrategy
, and NgModuleFactoryLoader
.
Annotations
@NgModule({
exports: [RouterModule],
providers: [
ROUTER_PROVIDERS, {provide: Location, useClass: SpyLocation},
{provide: LocationStrategy, useClass: MockLocationStrategy},
{provide: NgModuleFactoryLoader, useClass: SpyNgModuleFactoryLoader}, {
provide: Router,
useFactory: setupTestingRouter,
deps: [
UrlSerializer, RouterOutletMap, Location, NgModuleFactoryLoader, Compiler, Injector, ROUTES,
[UrlHandlingStrategy, new Optional()]
]
},
{provide: PreloadingStrategy, useExisting: NoPreloading}, provideRoutes([])
]
})
exported from @angular/router/testing/index, defined in @angular/router/testing/router_testing_module.ts