Skip to content

Commit

Permalink
Test case: add a test case for Pull request danrevah#228
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuldimri authored Jun 14, 2022
1 parent c0737c3 commit a256a46
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ng-pipes/pipes/date/time-ago.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ describe('TimeAgoPipe', () => {

const fewYearsAgoString = 5 + ' years ago';
const fewYearsAgoDate = new Date(new Date().setDate(new Date().getDate() - 365 * 5));

const invalidDateMessage = "Invalid date";
const invalidDateStr = "2022-02-21T019Z";

beforeAll(() => {
pipe = new TimeAgoPipe();
Expand Down Expand Up @@ -116,4 +119,9 @@ describe('TimeAgoPipe', () => {
it('should support moment.js last week', () => {
expect(pipe.transform(moment().subtract(10, 'days'))).toEqual('last week');
});


it('should throw invalid date for incorrect date string', () => {
expect(pipe.transform(invalidDateStr)).toEqual(invalidDateMessage);
});
});

0 comments on commit a256a46

Please sign in to comment.