@@ -4,7 +4,7 @@ describe('services', function () {
44 describe ( 'getCalendarDateString()' , function ( ) {
55 const timestamp = 1585561899000 ;
66 const expectedFormattedDate = '2020-03-30' ;
7- const invalidString = 'Invalid Date' ;
7+ const throwMessage = 'Invalid Date' ;
88 const epochDate = '1970-01-01' ;
99
1010 it ( 'should return undefined for undefined date' , function ( ) {
@@ -19,8 +19,8 @@ describe('services', function () {
1919 expect ( getCalendarDateString ( new Date ( '30 Mar 2020' ) ) ) . toEqual ( expectedFormattedDate ) ;
2020 } ) ;
2121
22- it ( 'should return "Invalid Date" for invalid JS Date' , function ( ) {
23- expect ( getCalendarDateString ( new Date ( '30/03/2020' ) ) ) . toEqual ( invalidString ) ;
22+ it ( 'should throw "Invalid Date" for invalid JS Date' , function ( ) {
23+ expect ( ( ) => { getCalendarDateString ( new Date ( '30/03/2020' ) ) ; } ) . toThrow ( throwMessage ) ;
2424 } ) ;
2525
2626 it ( 'should return dashed date for timestamp number' , function ( ) {
@@ -40,7 +40,7 @@ describe('services', function () {
4040 } ) ;
4141
4242 it ( 'should return "Invalid Date" for invalid date string' , function ( ) {
43- expect ( getCalendarDateString ( '30/3/2020' ) ) . toEqual ( invalidString ) ;
43+ expect ( getCalendarDateString ( '30/3/2020' ) ) . toEqual ( throwMessage ) ;
4444 } ) ;
4545 } ) ;
4646} ) ;
0 commit comments