Skip to content

Commit

Permalink
+ add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalii boiko committed Feb 16, 2019
1 parent dd43874 commit 4ef4575
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {ClockFaceTime} from '../models/clock-face-time.interface';
import {NgxMaterialTimepickerService} from './ngx-material-timepicker.service';
import {TimePeriod} from '../models/time-period.enum';
import * as moment from 'moment';
import { TimeAdapter } from './time-adapter';

describe('NgxMaterialTimepickerService', () => {
const DEFAULT_HOUR: ClockFaceTime = {
Expand Down Expand Up @@ -104,4 +105,14 @@ describe('NgxMaterialTimepickerService', () => {
expect(selectedMinute).toEqual({...DEFAULT_MINUTE, time: 10});
expect(selectedPeriod).toBe(TimePeriod.AM);
});

it('should call console error', () => {
const minutesGap = 5;
const min = TimeAdapter.convertTimeToMoment('11:00 pm');
const max = TimeAdapter.convertTimeToMoment('11:50 pm');
const spy = spyOn(console, 'error');

timepickerService.setDefaultTimeIfAvailable('11:43 pm', min, max, 12, minutesGap);
expect(spy).toHaveBeenCalled();
});
});

0 comments on commit 4ef4575

Please sign in to comment.