File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,9 @@ describe('TimeAgoPipe', () => {
44
44
45
45
const fewYearsAgoString = 5 + ' years ago' ;
46
46
const fewYearsAgoDate = new Date ( new Date ( ) . setDate ( new Date ( ) . getDate ( ) - 365 * 5 ) ) ;
47
+
48
+ const invalidDateMessage = "Invalid date" ;
49
+ const invalidDateStr = "2022-02-21T019Z" ;
47
50
48
51
beforeAll ( ( ) => {
49
52
pipe = new TimeAgoPipe ( ) ;
@@ -116,4 +119,9 @@ describe('TimeAgoPipe', () => {
116
119
it ( 'should support moment.js last week' , ( ) => {
117
120
expect ( pipe . transform ( moment ( ) . subtract ( 10 , 'days' ) ) ) . toEqual ( 'last week' ) ;
118
121
} ) ;
122
+
123
+
124
+ it ( 'should throw invalid date for incorrect date string' , ( ) => {
125
+ expect ( pipe . transform ( invalidDateStr ) ) . toEqual ( invalidDateMessage ) ;
126
+ } ) ;
119
127
} ) ;
You can’t perform that action at this time.
0 commit comments