import moment from 'moment' ; import { getPastDays } from './get_past_days' ; describe ( 'getPastDays' , ( ) => { test ( 'Returns 2 days that have passed from the current date' , ( ) => { const pastDate = moment ( ) . subtract ( 2 , 'days' ) . startOf ( 'day' ) . toString ( ) ; expect ( getPastDays ( pastDate ) ) . toEqual ( 2 ) ; } ) ; test ( 'Returns 30 days that have passed from the current date' , ( ) => { const pastDate = moment ( ) . subtract ( 30 , 'days' ) . startOf ( 'day' ) . toString ( ) ; expect ( getPastDays ( pastDate ) ) . toEqual ( 30 ) ; } ) ; } ) ;