Fix tests failing on thursdays

This commit is contained in:
kolaente 2021-07-09 09:48:33 +02:00
parent 21e96a08c9
commit 096fc0bbc8
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 0 additions and 2 deletions

View File

@ -168,7 +168,6 @@ describe('Parse Task Text', () => {
const nextThursday = new Date()
nextThursday.setDate(nextThursday.getDate() + ((4 + 7 - nextThursday.getDay()) % 7))
expect(`${result.date.getFullYear()}-${result.date.getMonth()}-${result.date.getDate()}`).toBe(`${nextThursday.getFullYear()}-${nextThursday.getMonth()}-${nextThursday.getDate()}`)
expect(+new Date(result.date)).toBeGreaterThan(+new Date() - 10) // In on thursdays, this may be different by one second and thus fails the test
})
it('should recognize weekdays with time', () => {
const result = parseTaskText('Lorem Ipsum thu at 14:00')
@ -178,7 +177,6 @@ describe('Parse Task Text', () => {
nextThursday.setDate(nextThursday.getDate() + ((4 + 7 - nextThursday.getDay()) % 7))
expect(`${result.date.getFullYear()}-${result.date.getMonth()}-${result.date.getDate()}`).toBe(`${nextThursday.getFullYear()}-${nextThursday.getMonth()}-${nextThursday.getDate()}`)
expect(`${result.date.getHours()}:${result.date.getMinutes()}`).toBe('14:0')
expect(+new Date(result.date)).toBeGreaterThan(+new Date() - 10) // In on thursdays, this may be different by one second and thus fails the test
})
it('should recognize dates of the month in the past but next month', () => {
const date = new Date()