ngmodule
Sets up the router to be used for testing.
class RouterTestingModule { static withRoutes(routes: Routes, config?: ExtraOptions): ModuleWithProviders<RouterTestingModule> }
The modules sets up the router to be used for testing. It provides spy implementations of Location
and LocationStrategy
.
Further information is available in the Usage Notes...
withRoutes() | ||||||
---|---|---|---|---|---|---|
|
routes | Routes | |
config | ExtraOptions | Optional. Default is |
Provider |
---|
ROUTER_PROVIDERS |
provideLocationMocks() |
withPreloading(NoPreloading).ɵproviders |
{ provide: ROUTES, multi: true, useValue: [] } |
beforeEach(() => { TestBed.configureTestingModule({ imports: [ RouterModule.forRoot( [{path: '', component: BlankCmp}, {path: 'simple', component: SimpleCmp}] ) ] }); });
© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/router/testing/RouterTestingModule