@@ -3,36 +3,23 @@ import {
33 TestBed ,
44} from '@angular/core/testing' ;
55import { ActivatedRoute } from '@angular/router' ;
6- import { Store } from '@ngrx/store' ;
76import { TranslateModule } from '@ngx-translate/core' ;
87import { MockComponent } from 'ng-mocks' ;
98import {
109 Observable ,
1110 of ,
1211} from 'rxjs' ;
13- import { AuthService } from 'src/app/core/auth/auth.service' ;
14- import { AuthTokenInfo } from 'src/app/core/auth/models/auth-token-info.model' ;
15- import { ObjectCacheService } from 'src/app/core/cache/object-cache.service' ;
1612import { SiteDataService } from 'src/app/core/data/site-data.service' ;
1713import { LocaleService } from 'src/app/core/locale/locale.service' ;
18- import { CookieService } from 'src/app/core/services/cookie.service' ;
19- import {
20- NativeWindowRef ,
21- NativeWindowService ,
22- } from 'src/app/core/services/window.service' ;
2314import { Site } from 'src/app/core/shared/site.model' ;
24- import { CookieServiceMock } from 'src/app/shared/mocks/cookie.service.mock' ;
2515
2616import { MarkdownViewerComponent } from '../../shared/markdown-viewer/markdown-viewer.component' ;
2717import { CmsInfoComponent } from './cms-info.component' ;
2818
2919describe ( 'CmsInfoComponent' , ( ) => {
3020 let component : CmsInfoComponent ;
3121 let fixture : ComponentFixture < CmsInfoComponent > ;
32- let authService : AuthService ;
33- let token : AuthTokenInfo ;
34- let store ;
35- let redirectUrl : string ;
22+ let localeServiceSpy : jasmine . SpyObj < LocaleService > ;
3623 let activatedRouteStub : any ;
3724 let siteServiceStub : any ;
3825
@@ -50,13 +37,8 @@ describe('CmsInfoComponent', () => {
5037 } ) ;
5138
5239 beforeEach ( async ( ) => {
53- redirectUrl = 'redirect/url' ;
54- token = new AuthTokenInfo ( 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9' ) ;
55- authService = jasmine . createSpyObj ( 'authService' , {
56- isAuthenticated : of ( true ) ,
57- getToken : token ,
58- } ) ;
59- store = jasmine . createSpyObj ( 'store' , [ 'dispatch' ] ) ;
40+ localeServiceSpy = jasmine . createSpyObj ( 'LocaleService' , [ 'getCurrentLanguageCode' ] ) ;
41+ localeServiceSpy . getCurrentLanguageCode . and . returnValue ( of ( 'en' ) ) ;
6042 activatedRouteStub = {
6143 data : of ( { schema : 'cris' , qualifier : 'testQualifier' } ) ,
6244 queryParamMap : of ( { } ) ,
@@ -73,13 +55,8 @@ describe('CmsInfoComponent', () => {
7355 MockComponent ( MarkdownViewerComponent ) ,
7456 ] ,
7557 providers : [
76- LocaleService ,
77- ObjectCacheService ,
7858 { provide : SiteDataService , useValue : siteServiceStub } ,
79- { provide : Store , useValue : store } ,
80- { provide : AuthService , useValue : authService } ,
81- { provide : CookieService , useValue : new CookieServiceMock } ,
82- { provide : NativeWindowService , useValue : new NativeWindowRef ( ) } ,
59+ { provide : LocaleService , useValue : localeServiceSpy } ,
8360 { provide : ActivatedRoute , useValue : activatedRouteStub } ,
8461 ] ,
8562 } )
0 commit comments