@@ -9,36 +9,27 @@ import {
99import { ActivatedRoute , DefaultUrlSerializer , Router , RouterConfig , RouterOutletMap , UrlSerializer } from '@angular/router' ;
1010import { Location , LocationStrategy } from '@angular/common' ;
1111import { Observable } from 'rxjs/Observable' ;
12- import { MockLocationStrategy } from '@angular/common/testing/mock_location_strategy' ;
1312import { SpyLocation } from '@angular/common/testing' ;
1413
1514import { Component , provide , ComponentResolver , Injector } from '@angular/core' ;
1615
1716import { AppComponent } from './app.component' ;
1817import { MessageService , MessageComponent } from './shared/message/index' ;
1918
20- class MockRouter extends Router {
21- constructor ( ) {
22- super ( null , null , null , null , null , null , null ) ;
23- }
24- }
25- let routerProviderMock = { provide : Router , useFactory : ( ) => { return new MockRouter ( ) } } ;
26-
2719beforeEachProviders ( ( ) => {
2820 let config : RouterConfig = [ { path : '' , component : AppComponent } ] ;
2921 return [
3022 RouterOutletMap ,
31- { provide : UrlSerializer , useClass : DefaultUrlSerializer } ,
32- { provide : Location , useClass : SpyLocation } ,
33- { provide : LocationStrategy , useClass : MockLocationStrategy } ,
34- {
35- provide : Router ,
36- useFactory : ( resolver : ComponentResolver , urlSerializer : UrlSerializer , outletMap : RouterOutletMap , location : Location , injector : Injector ) => {
37- return new Router ( AppComponent , resolver , urlSerializer , outletMap , location , injector , config ) ;
38- } ,
39- deps : [ ComponentResolver , UrlSerializer , RouterOutletMap , Location , Injector ]
23+ { provide : UrlSerializer , useClass : DefaultUrlSerializer } ,
24+ { provide : Location , useClass : SpyLocation } ,
25+ {
26+ provide : Router ,
27+ useFactory : ( resolver : ComponentResolver , urlSerializer : UrlSerializer , outletMap : RouterOutletMap , location : Location , injector : Injector ) => {
28+ return new Router ( AppComponent , resolver , urlSerializer , outletMap , location , injector , config ) ;
4029 } ,
41- { provide : ActivatedRoute , useFactory : ( r : Router ) => r . routerState . root , deps : [ Router ] } ,
30+ deps : [ ComponentResolver , UrlSerializer , RouterOutletMap , Location , Injector ]
31+ } ,
32+ { provide : ActivatedRoute , useFactory : ( r : Router ) => r . routerState . root , deps : [ Router ] } ,
4233 MessageService ,
4334 AppComponent
4435 ]
@@ -51,4 +42,4 @@ describe('App: AppComponent', () => {
5142 it ( 'should have as title \'Equalize rocks!\'' , inject ( [ AppComponent ] , ( app : AppComponent ) => {
5243 expect ( app . title ) . toEqual ( 'Equalize rocks!' ) ;
5344 } ) ) ;
54- } ) ;
45+ } ) ;
0 commit comments