11import { HttpClient } from '@angular/common/http' ;
2- import { HttpClientTestingModule , HttpTestingController } from '@angular/common/http/testing' ;
2+ import { HttpClientTestingModule } from '@angular/common/http/testing' ;
33import { TestBed } from '@angular/core/testing' ;
44import { JwtHelperService } from '@auth0/angular-jwt' ;
55import { SocialAuthService } from 'angularx-social-login' ;
@@ -10,7 +10,6 @@ import { LoginService } from './login.service';
1010
1111describe ( 'LoginService' , ( ) => {
1212 let service : LoginService ;
13- let httpMock : HttpTestingController ;
1413 let cookieService : CookieService ;
1514 let socialAuthService : SocialAuthService ;
1615 let account ;
@@ -33,7 +32,6 @@ describe('LoginService', () => {
3332 } ) ;
3433 service = TestBed . inject ( LoginService ) ;
3534 cookieService = TestBed . inject ( CookieService ) ;
36- httpMock = TestBed . inject ( HttpTestingController ) ;
3735 socialAuthService = TestBed . inject ( SocialAuthService ) ;
3836 account = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6ImFiYyIsIm5hbWUiOiJhYmMiLCJlbWFpbCI6ImFiYyIsImdyb3VwcyI6WyJhYmMiXX0.UNxyDT8XzXJhI1F3LySBU7TJlpENPUPHj8my7Obw2ZM' ;
3937 let store = { } ;
@@ -94,14 +92,14 @@ describe('LoginService', () => {
9492 } ) ;
9593
9694 it ( 'load a user by sending a token using POST' , ( ) => {
97- const token = 'test_123'
95+ const token = 'test_123' ;
9896 service . baseUrl = '/users' ;
9997 const mockSuccessDataPost = {
10098 SUCCESS : true ,
10199 data : { }
102- }
100+ } ;
103101 httpClientSpy . post . and . returnValue ( of ( mockSuccessDataPost ) ) ;
104- service . getUser ( ' token' ) . subscribe ( ) ;
102+ service . getUser ( token ) . subscribe ( ) ;
105103 expect ( httpClientSpy . post ) . toHaveBeenCalled ( ) ;
106104 } ) ;
107105
@@ -161,12 +159,12 @@ describe('LoginService', () => {
161159 it ( 'should call setLocalStorage when there is a new_token ' , ( ) => {
162160 spyOn ( cookieService , 'check' ) . and . returnValue ( true ) ;
163161 spyOn ( service , 'setLocalStorage' ) ;
164- const token = 'test123'
162+ const token = 'test123' ;
165163 service . baseUrl = '/users' ;
166164 const mockSuccessDataPost = {
167165 SUCCESS : true ,
168166 new_token : 'test_token'
169- }
167+ } ;
170168 httpClientSpy . post . and . returnValue ( of ( mockSuccessDataPost ) ) ;
171169 service . isValidToken ( token ) . subscribe ( ) ;
172170 expect ( service . setLocalStorage ) . toHaveBeenCalled ( ) ;
0 commit comments