import { ComponentFixture , TestBed } from "@angular/core/testing" ; import { EditDatedAthleteSettingsDialogComponent } from "./edit-dated-athlete-settings-dialog.component" ; import { MAT_DIALOG_DATA , MatDialogRef } from "@angular/material" ; import { CoreModule } from "../../../core/core.module" ; import { SharedModule } from "../../../shared/shared.module" ; import { AthleteSettingsModule } from "../../athlete-settings.module" ; import * as _ from "lodash" ; import { DatedAthleteSettingsDialogData } from "./dated-athlete-settings-dialog-data.model" ; import { DatedAthleteSettingsAction } from "./dated-athlete-settings-action.enum" ; import { DatedAthleteSettingsModel } from "@elevate/shared/models" ; import { userSettingsData } from "@elevate/shared/data" ; import { UserSettingsService } from "../../../shared/services/user-settings/user-settings.service" ; describe ( "EditDatedAthleteSettingsDialogComponent" , ( ) => { let component ; let fixture ; let userSettingsService ; beforeEach ( ( done ) => { const datedAthleteSettingsDialogData = { action : DatedAthleteSettingsAction . ACTION_ADD , datedAthleteSettingsModel : DatedAthleteSettingsModel . DEFAULT_MODEL } ; TestBed . configureTestingModule ( { imports : [ CoreModule , SharedModule , AthleteSettingsModule ] , providers : [ { provide : MAT_DIALOG_DATA , useValue : datedAthleteSettingsDialogData , } , { provide : MatDialogRef , useValue : { } , } ] } ) . compileComponents ( ) ; userSettingsService = TestBed . get ( UserSettingsService ) ; spyOn ( userSettingsService , "fetch" ) . and . returnValue ( Promise . resolve ( _ . cloneDeep ( userSettingsData ) ) ) ; fixture = TestBed . createComponent ( EditDatedAthleteSettingsDialogComponent ) ; component = fixture . componentInstance ; fixture . detectChanges ( ) ; done ( ) ; } ) ; it ( "should create" , ( done ) => { expect ( component ) . toBeTruthy ( ) ; done ( ) ; } ) ; } ) ;