@@ -3,7 +3,7 @@ import { HttpTestingController, provideHttpClientTesting } from '@angular/common
3
3
import { HTTP_INTERCEPTORS , HttpClient } from '@angular/common/http' ;
4
4
import { JwtInterceptor } from './jwt.interceptor' ;
5
5
import { AuthenticationService } from '../_services/authentication.service' ;
6
- import { API_CONFIG } from '../app/api.config ' ;
6
+ import { environment } from '../environments/environment.development ' ;
7
7
8
8
describe ( 'JwtInterceptor' , ( ) => {
9
9
let httpMock : HttpTestingController ;
@@ -34,9 +34,9 @@ describe('JwtInterceptor', () => {
34
34
} ) ;
35
35
36
36
it ( 'should add an Authorization header' , ( ) => {
37
- httpClient . get ( `${ API_CONFIG . baseUrl } /user/test` ) . subscribe ( ) ;
37
+ httpClient . get ( `${ environment . apiUrl } /user/test` ) . subscribe ( ) ;
38
38
39
- const httpRequest = httpMock . expectOne ( `${ API_CONFIG . baseUrl } /user/test` ) ;
39
+ const httpRequest = httpMock . expectOne ( `${ environment . apiUrl } /user/test` ) ;
40
40
41
41
expect ( httpRequest . request . headers . has ( 'Authorization' ) ) . toBeTruthy ( ) ;
42
42
expect ( httpRequest . request . headers . get ( 'Authorization' ) ) . toBe ( 'Bearer fake-jwt-token' ) ;
@@ -47,9 +47,9 @@ describe('JwtInterceptor', () => {
47
47
userValue : { } ,
48
48
} ) ;
49
49
50
- httpClient . get ( `${ API_CONFIG . baseUrl } /user/test` ) . subscribe ( ) ;
50
+ httpClient . get ( `${ environment . apiUrl } /user/test` ) . subscribe ( ) ;
51
51
52
- const httpRequest = httpMock . expectOne ( `${ API_CONFIG . baseUrl } /user/test` ) ;
52
+ const httpRequest = httpMock . expectOne ( `${ environment . apiUrl } /user/test` ) ;
53
53
54
54
expect ( httpRequest . request . headers . has ( 'Authorization' ) ) . toBeFalsy ( ) ;
55
55
} ) ;
0 commit comments