import { async , ComponentFixture , TestBed } from '@angular/core/testing' ; import { MockComponent } from 'ng2-mock-component' ; import { Event } from '../../event' ; import { MockPipe } from '../../mock-pipe' ; import { NearbySeismicityPinComponent } from './nearby-seismicity-pin.component' ; describe ( 'NearbySeismicityPinComponent' , ( ) => { let component ; let fixture ; let event ; beforeEach ( async ( ( ) => { TestBed . configureTestingModule ( { declarations : [ NearbySeismicityPinComponent , MockComponent ( { inputs : [ 'footer' , 'title' , 'href' ] , selector : 'basic-pin' } ) , MockPipe ( 'sharedNumber' ) ] } ) . compileComponents ( ) ; } ) ) ; beforeEach ( ( ) => { event = new Event ( { id : 'us10004u1y' } ) ; fixture = TestBed . createComponent ( NearbySeismicityPinComponent ) ; component = fixture . componentInstance ; component . title = 'Nearby Seismicity' ; component . event = event ; component . link = 'testLink' ; fixture . detectChanges ( ) ; } ) ; it ( 'should create' , ( ) => { expect ( component ) . toBeTruthy ( ) ; } ) ; describe ( 'Minimum Magnitude Variations' , ( ) => { it ( 'should return 6' , ( ) => { expect ( component . getMinimumMag ( 9 ) ) . toBe ( 6 ) ; } ) ; it ( 'should return 5' , ( ) => { expect ( component . getMinimumMag ( 8 ) ) . toBe ( 5 ) ; } ) ; it ( 'should return 4' , ( ) => { expect ( component . getMinimumMag ( 7 ) ) . toBe ( 4 ) ; } ) ; it ( 'should return 3' , ( ) => { expect ( component . getMinimumMag ( 6 ) ) . toBe ( 3 ) ; } ) ; it ( 'should return 2' , ( ) => { expect ( component . getMinimumMag ( 5 ) ) . toBe ( 2 ) ; } ) ; it ( 'should return 1' , ( ) => { expect ( component . getMinimumMag ( 4 ) ) . toBe ( 1 ) ; } ) ; it ( 'should return 1' , ( ) => { expect ( component . getMinimumMag ( 1 ) ) . toBe ( 1 ) ; } ) ; } ) ; } ) ;