import { AthleteUpdateModel } from "../../scripts/models/athlete-update.model" ; import { AthleteUpdate } from "../../scripts/utils/athlete-update" ; describe ( "Generate Athlete Update" , ( ) => { it ( "should return compliant AthleteUpdate (free)" , ( done ) => { const doe = AthleteUpdate . create ( 123 , "John Doe" , "5.0.0" , false , false , "France" , 65 , 190 ) ; expect ( doe ) . not . toBeNull ( ) ; expect ( doe . stravaId ) . toEqual ( 123 ) ; expect ( doe . name ) . toEqual ( "John Doe" ) ; expect ( doe . version ) . toEqual ( "5.0.0" ) ; expect ( doe . status ) . toEqual ( 0 ) ; expect ( doe . locale ) . toEqual ( "France" ) ; expect ( doe . hrMin ) . toEqual ( 65 ) ; expect ( doe . hrMax ) . toEqual ( 190 ) ; done ( ) ; } ) ; it ( "should return compliant AthleteUpdate (premium)" , ( done ) => { const doe = AthleteUpdate . create ( 777 , "My Self" , "5.0.0" , true , false , "France" , 65 , 190 ) ; expect ( doe ) . not . toBeNull ( ) ; expect ( doe . stravaId ) . toEqual ( 777 ) ; expect ( doe . name ) . toEqual ( "My Self" ) ; expect ( doe . version ) . toEqual ( "5.0.0" ) ; expect ( doe . status ) . toEqual ( 1 ) ; expect ( doe . locale ) . toEqual ( "France" ) ; expect ( doe . hrMax ) . toEqual ( 190 ) ; expect ( doe . hrMin ) . toEqual ( 65 ) ; done ( ) ; } ) ; it ( "should return compliant AthleteUpdate (pro)" , ( done ) => { const froom = AthleteUpdate . create ( 999 , "Chris Froome" , "5.1.0" , false , true , "United KingHome" ) ; expect ( froom ) . not . toBeNull ( ) ; expect ( froom . stravaId ) . toEqual ( 999 ) ; expect ( froom . name ) . toEqual ( "Chris Froome" ) ; expect ( froom . name ) . not . toEqual ( "John Doe" ) ; expect ( froom . version ) . toEqual ( "5.1.0" ) ; expect ( froom . status ) . toEqual ( 2 ) ; expect ( froom . locale ) . toEqual ( "United KingHome" ) ; const cavendish = AthleteUpdate . create ( 888 , "Cavendish" , "5.1.0" , true , true , "" ) ; expect ( cavendish ) . not . toBeNull ( ) ; expect ( cavendish . status ) . toEqual ( 2 ) ; expect ( cavendish . locale ) . toBeUndefined ( ) ; done ( ) ; } ) ; it ( "should pass monkey tests" , ( done ) => { const monkey_01 = AthleteUpdate . create ( 888 , "" , "5.1.0" , true , true , "" ) ; expect ( monkey_01 ) . toBeNull ( ) ; const monkey_02 = AthleteUpdate . create ( 888 , "Monkey" , "" , false , false , "" ) ; expect ( monkey_02 ) . toBeNull ( ) ; const monkey_03 = AthleteUpdate . create ( 888 , null , null , false , false ) ; expect ( monkey_03 ) . toBeNull ( ) ; done ( ) ; } ) ; } ) ;