import assert from 'assert' ; import isSameYear from '.' ; describe ( 'isSameYear' , ( ) => { it ( 'returns true if the given dates have the same year' , ( ) => { const result = isSameYear ( new Date ( 2014 , 8 , 2 ) , new Date ( 2014 , 8 , 25 ) ) ; assert ( result === true ) ; } ) ; it ( 'returns false if the given dates have different years' , ( ) => { const result = isSameYear ( new Date ( 2014 , 8 , 2 ) , new Date ( 2013 , 8 , 25 ) ) ; assert ( result === false ) ; } ) ; it ( 'accepts a timestamp' , ( ) => { const result = isSameYear ( new Date ( 2014 , 8 , 2 ) . getTime ( ) , new Date ( 2014 , 8 , 25 ) . getTime ( ) ) ; assert ( result === true ) ; } ) ; it ( 'returns false if the first date is `Invalid Date`' , ( ) => { const result = isSameYear ( new Date ( NaN ) , new Date ( 1989 , 6 , 10 ) ) ; assert ( result === false ) ; } ) ; it ( 'returns false if the second date is `Invalid Date`' , ( ) => { const result = isSameYear ( new Date ( 1987 , 1 , 11 ) , new Date ( NaN ) ) ; assert ( result === false ) ; } ) ; it ( 'returns false if the both dates are `Invalid Date`' , ( ) => { const result = isSameYear ( new Date ( NaN ) , new Date ( NaN ) ) ; assert ( result === false ) ; } ) ; it ( 'throws TypeError exception if passed less than 2 arguments' , ( ) => { assert . throws ( isSameYear . bind ( null ) , TypeError ) ; assert . throws ( isSameYear . bind ( null , 1 ) , TypeError ) ; } ) ; } ) ;