We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c0737c3 commit a256a46Copy full SHA for a256a46
src/ng-pipes/pipes/date/time-ago.spec.ts
@@ -44,6 +44,9 @@ describe('TimeAgoPipe', () => {
44
45
const fewYearsAgoString = 5 + ' years ago';
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";
50
51
beforeAll(() => {
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
+ });
127
0 commit comments