import { ComponentFixture , TestBed } from "@angular/core/testing" ; import { GlobalSettingsComponent } from "./global-settings.component" ; import { SharedModule } from "../shared/shared.module" ; import * as _ from "lodash" ; import { userSettingsData } from "@elevate/shared/data" ; import { CoreModule } from "../core/core.module" ; import { UserSettingsService } from "../shared/services/user-settings/user-settings.service" ; describe ( "GlobalSettingsComponent" , ( ) => { let component ; let fixture ; let userSettingsService ; beforeEach ( ( done ) => { TestBed . configureTestingModule ( { imports : [ CoreModule , SharedModule , ] , declarations : [ ] , providers : [ ] } ) . compileComponents ( ) ; userSettingsService = TestBed . get ( UserSettingsService ) ; spyOn ( userSettingsService , "fetch" ) . and . returnValue ( Promise . resolve ( _ . cloneDeep ( userSettingsData ) ) ) ; done ( ) ; } ) ; beforeEach ( ( done ) => { fixture = TestBed . createComponent ( GlobalSettingsComponent ) ; component = fixture . componentInstance ; fixture . detectChanges ( ) ; done ( ) ; } ) ; it ( "should create" , ( done ) => { expect ( component ) . toBeTruthy ( ) ; done ( ) ; } ) ; it ( "should get option helper dir" , ( done ) => { const pathname = "/app/index.html" ; const expected = "/app/assets/option-helpers/" ; const actual = GlobalSettingsComponent . getOptionHelperDir ( pathname ) ; expect ( actual ) . toEqual ( expected ) ; done ( ) ; } ) ; it ( "should get option helper dir" , ( done ) => { const pathname = null ; const actual = GlobalSettingsComponent . getOptionHelperDir ( pathname ) ; expect ( actual ) . toBeNull ( ) ; done ( ) ; } ) ; } ) ;