RouterTestingModule
Sets up the router to be used for testing.
Deprecated: Use provideRouter
or RouterModule
/RouterModule.forRoot
instead.
This module was previously used to provide a helpful collection of test fakes,
most notably those for Location
and LocationStrategy
. These are generally not
required anymore, as MockPlatformLocation
is provided in TestBed
by default.
However, you can use them directly with provideLocationMocks
.
class RouterTestingModule {
static withRoutes(routes: Routes, config?: ExtraOptions): ModuleWithProviders<RouterTestingModule>
}
Description
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...
Static methods
withRoutes() | ||||||
---|---|---|---|---|---|---|
Parameters
Returns |
Providers
Provider |
---|
|
|
|
|
Usage notes
Example
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
RouterModule.forRoot(
[{path: '', component: BlankCmp}, {path: 'simple', component: SimpleCmp}]
)
]
});
});