RouterTestingModule
From Get docs
< @angular/router | testingAngular/docs/11/api/router/testing/routertestingmodule
RouterTestingModule
ngmodule
Sets up the router to be used for testing.
class RouterTestingModule {
static withRoutes(routes: Route[], config?: ExtraOptions): ModuleWithProviders<RouterTestingModule>
}
Description
The modules sets up the router to be used for testing. It provides spy implementations of Location
, LocationStrategy
, and NgModuleFactoryLoader.
Further information available in the Usage Notes...
Static methods
withRoutes() | ||||||
---|---|---|---|---|---|---|
static withRoutes(routes: Route[], config?: ExtraOptions): ModuleWithProviders<RouterTestingModule>Parameters
Returns
|
Providers
Provider |
---|
|
|
|
|
|
|
|
Usage notes
Example
beforeEach(() => { TestBed.configureTestingModule({ imports: [ RouterTestingModule.withRoutes( [{path: '', component: BlankCmp}, {path: 'simple', component: SimpleCmp}] ) ] }); });
© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v11.angular.io/api/router/testing/RouterTestingModule