Skip to content

Commit

Permalink
chore: add parseTime() tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Tsoi committed Feb 12, 2020
1 parent 048902e commit 50cd9d9
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions components/i18n/date-helper.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,29 @@ describe('DateHelperService', () => {
expect(dateHelper.getFirstDayOfWeek()).toBe(4);
});
});

describe('ParseTime', () => {
beforeEach(() => {
injector = TestBed.configureTestingModule({
imports: [NzI18nModule]
});

dateHelper = injector.get(DateHelperService);
});

it('should parse custom time', () => {
expect(
dateHelper
.parseTime('14:00')
?.toTimeString()
.substr(0, 8)
).toBe('14:00:00');
expect(
dateHelper
.parseTime('4:00')
?.toTimeString()
.substr(0, 8)
).toBe('04:00:00');
});
});
});

0 comments on commit 50cd9d9

Please sign in to comment.