chore: fix date tests
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
import { dateFromDSLDateString } from './Utils'
|
||||
import { addDaysToDate, addHoursToDate } from '@standardnotes/utils'
|
||||
|
||||
describe('Predicate Utils', () => {
|
||||
describe('dateFromDSLDateString', () => {
|
||||
it('should return a date object with the correct day', () => {
|
||||
const date = dateFromDSLDateString('1.days.ago')
|
||||
expect(date.getDate()).toEqual(new Date().getDate() - 1)
|
||||
expect(date.getDate()).toEqual(addDaysToDate(new Date(), -1).getDate())
|
||||
})
|
||||
|
||||
it('should return a date object with the correct hour', () => {
|
||||
const date = dateFromDSLDateString('1.hours.ago')
|
||||
expect(date.getHours()).toEqual(new Date().getHours() - 1)
|
||||
expect(date.getHours()).toEqual(addHoursToDate(new Date(), -1).getHours())
|
||||
})
|
||||
|
||||
it('should return a date object with the correct month', () => {
|
||||
|
||||
Reference in New Issue
Block a user