@@ -9,7 +9,6 @@ import { RouteService } from './route.service';
99import { RouterMock } from '../../shared/mocks/router.mock' ;
1010import { TestScheduler } from 'rxjs/testing' ;
1111import { AddUrlToHistoryAction } from '../history/history.actions' ;
12- import { NativeWindowRefMock } from '../../shared/mocks/mock-native-window-ref' ;
1312
1413describe ( 'RouteService' , ( ) => {
1514 let scheduler : TestScheduler ;
@@ -49,19 +48,17 @@ describe('RouteService', () => {
4948 } ,
5049 { provide : Router , useValue : router } ,
5150 { provide : Store , useValue : store } ,
52- { provide : NativeWindowRefMock , useClass : NativeWindowRefMock }
5351 ]
5452 } ) ;
5553 } ) ) ;
5654
5755 beforeEach ( ( ) => {
58- service = new RouteService ( TestBed . inject ( ActivatedRoute ) , TestBed . inject ( Router ) , TestBed . inject ( Store ) , TestBed . inject ( NativeWindowRefMock ) ) ;
56+ service = new RouteService ( TestBed . inject ( ActivatedRoute ) , TestBed . inject ( Router ) , TestBed . inject ( Store ) ) ;
5957 serviceAsAny = service ;
6058 } ) ;
6159
6260 describe ( 'hasQueryParam' , ( ) => {
6361 it ( 'should return true when the parameter name exists' , ( ) => {
64- spyOnProperty ( serviceAsAny . _window . nativeWindow . location , 'href' ) . and . returnValue ( 'http://localhost?name=Test%20Name' ) ;
6562 service . hasQueryParam ( paramName1 ) . subscribe ( ( status ) => {
6663 expect ( status ) . toBeTruthy ( ) ;
6764 } ) ;
@@ -75,7 +72,6 @@ describe('RouteService', () => {
7572
7673 describe ( 'hasQueryParamWithValue' , ( ) => {
7774 it ( 'should return true when the parameter name exists and contains the specified value' , ( ) => {
78- spyOnProperty ( serviceAsAny . _window . nativeWindow . location , 'href' ) . and . returnValue ( 'http://localhost?name=Test%20Name' ) ;
7975 service . hasQueryParamWithValue ( paramName2 , paramValue2a ) . subscribe ( ( status ) => {
8076 expect ( status ) . toBeTruthy ( ) ;
8177 } ) ;
@@ -94,7 +90,6 @@ describe('RouteService', () => {
9490
9591 describe ( 'getQueryParameterValues' , ( ) => {
9692 it ( 'should return a list of values when the parameter exists' , ( ) => {
97- spyOnProperty ( serviceAsAny . _window . nativeWindow . location , 'href' ) . and . returnValue ( 'http://localhost?id=Test%20id&another=another%20id' ) ;
9893 service . getQueryParameterValues ( paramName2 ) . subscribe ( ( params ) => {
9994 expect ( params ) . toEqual ( [ paramValue2a , paramValue2b ] ) ;
10095 } ) ;
@@ -109,14 +104,12 @@ describe('RouteService', () => {
109104
110105 describe ( 'getQueryParameterValue' , ( ) => {
111106 it ( 'should return a single value when the parameter exists' , ( ) => {
112- spyOnProperty ( serviceAsAny . _window . nativeWindow . location , 'href' ) . and . returnValue ( 'http://localhost?name=Test%20Name' ) ;
113107 service . getQueryParameterValue ( paramName1 ) . subscribe ( ( params ) => {
114108 expect ( params ) . toEqual ( paramValue1 ) ;
115109 } ) ;
116110 } ) ;
117111
118112 it ( 'should return only the first value when the parameter exists' , ( ) => {
119- spyOnProperty ( serviceAsAny . _window . nativeWindow . location , 'href' ) . and . returnValue ( 'http://localhost?id=Test%id' ) ;
120113 service . getQueryParameterValue ( paramName2 ) . subscribe ( ( params ) => {
121114 expect ( params ) . toEqual ( paramValue2a ) ;
122115 } ) ;
0 commit comments