@@ -5,7 +5,7 @@ import { ActivatedRoute, RouterOutletMap, RouterState, Router } from '@angular/r
55import { RouterTestingModule } from '@angular/router/testing' ;
66
77import { Angular2TokenService } from './angular2-token.service' ;
8- import {
8+ import {
99 SignInData ,
1010 RegisterData
1111} from './angular2-token.model' ;
@@ -22,6 +22,7 @@ describe('Angular2TokenService', () => {
2222 let emptyHeaders = new Headers ( {
2323 'content-Type' : 'application/json'
2424 } ) ;
25+
2526 let tokenHeaders = new Headers ( {
2627 'content-Type' : 'application/json' ,
2728 'token-type' : tokenType ,
@@ -181,25 +182,25 @@ describe('Angular2TokenService', () => {
181182 } ) ) ;
182183
183184 it ( 'validateToken should call signOut when it returns status 401' , inject ( [ Angular2TokenService , MockBackend ] , ( tokenService , mockBackend ) => {
184-
185+
185186 mockBackend . connections . subscribe (
186187 c => c . mockError ( new Response ( new ResponseOptions ( { status : 401 , headers : new Headers ( ) } ) ) )
187188 ) ;
188189
189190 spyOn ( tokenService , 'signOut' ) ;
190-
191+
191192 tokenService . init ( { apiPath : 'myapi' , signOutFailedValidate : true } ) ;
192193 tokenService . validateToken ( ) . subscribe ( res => null , err => expect ( tokenService . signOut ) . toHaveBeenCalled ( ) ) ;
193194 } ) ) ;
194195
195196 it ( 'validateToken should not call signOut when it returns status 401' , inject ( [ Angular2TokenService , MockBackend ] , ( tokenService , mockBackend ) => {
196-
197+
197198 mockBackend . connections . subscribe (
198199 c => c . mockError ( new Response ( new ResponseOptions ( { status : 401 , headers : new Headers ( ) } ) ) )
199200 ) ;
200201
201202 spyOn ( tokenService , 'signOut' ) ;
202-
203+
203204 tokenService . init ( { apiPath : 'myapi' , signOutFailedValidate : false } ) ;
204205 tokenService . validateToken ( ) . subscribe ( res => null , err => expect ( tokenService . signOut ) . not . toHaveBeenCalled ( ) ) ;
205206 } ) ) ;
0 commit comments