huridocs/uwazi

View on GitHub
app/shared/specs/isSameDate.spec.ts

Summary

Maintainability
A
0 mins
Test Coverage
import moment from 'moment';
import { isSameDate } from 'shared/isSameDate';

it('should only consider year, month and day', () => {
  const todayUtc = moment().utc();
  const todayInAnHourUtc = todayUtc.clone().add(1, 'hour');
  expect(isSameDate(todayUtc.unix(), todayInAnHourUtc.unix())).toBe(true);

  const tomorrowUtc = todayUtc.clone().add(1, 'day');
  expect(isSameDate(todayUtc.unix(), tomorrowUtc.unix())).toBe(false);
});