11import test from 'tape' ;
22import { getDay , getNDays } from '../src/day' ;
33
4- const TEST_DAY = '12.28.2016' ;
4+ const TEST_DAY = '12.28.2016 14:24:05 ' ;
55
66test ( 'Calendar Model: Day' , nest => {
77 nest . test ( 'Returns a Day Object when Asked for a Day Provided a String Date' , assert => {
@@ -24,11 +24,31 @@ test('Calendar Model: Day', nest => {
2424 assert . ok ( day . weekOfYear === 52 , 'should be 52' ) ;
2525 assert . end ( ) ;
2626 } ) ;
27+ nest . test ( 'Returns a 24-hour time' , assert => {
28+ const day = getDay ( { date : TEST_DAY } ) ;
29+ assert . ok ( day . twentyFourHourTime === '14:24:05' , 'should be 14:24:05' ) ;
30+ assert . end ( ) ;
31+ } ) ;
32+ nest . test ( 'Returns a 12-hour time' , assert => {
33+ const day = getDay ( { date : TEST_DAY } ) ;
34+ assert . ok ( day . twelveHourTime === '02:24:05' , 'should be 02:24:05' ) ;
35+ assert . end ( ) ;
36+ } ) ;
2737 nest . test ( 'Returns a one-based month number' , assert => {
2838 const day = getDay ( { date : TEST_DAY } ) ;
2939 assert . ok ( day . month === 12 , 'should be 12' ) ;
3040 assert . end ( ) ;
3141 } ) ;
42+ nest . test ( 'Returns a formatted date' , assert => {
43+ const day = getDay ( { date : TEST_DAY } ) ;
44+ assert . ok ( day . formattedDate === '28/12/2016' , 'should be 28/12/2016' ) ;
45+ assert . end ( ) ;
46+ } ) ;
47+ nest . test ( 'Returns an ISO formatted date' , assert => {
48+ const day = getDay ( { date : TEST_DAY } ) ;
49+ assert . ok ( day . month === 12 , 'should be 12' ) ;
50+ assert . end ( ) ;
51+ } ) ;
3252 nest . test ( 'Returns a set of days, given a start date and a count' , assert => {
3353 const daySet = getNDays ( { startDate : TEST_DAY , numOfDays : 4 } ) ;
3454 assert . ok ( daySet . length === 5 , 'should be 5 days' ) ;
0 commit comments