]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix relative date test that will fail across months
authorshamoon <4887959+shamoon@users.noreply.github.com>
Wed, 1 May 2024 05:06:19 +0000 (22:06 -0700)
committershamoon <4887959+shamoon@users.noreply.github.com>
Wed, 1 May 2024 19:07:27 +0000 (12:07 -0700)
src-ui/src/app/pipes/custom-date.pipe.spec.ts

index ddc03c773e6672f679aa953b4aa15431a6b82e08..32505fa7ca0ffe8011b75da5021baac03ab6f063 100644 (file)
@@ -33,8 +33,9 @@ describe('CustomDatePipe', () => {
     const notNow = new Date(now)
     notNow.setDate(now.getDate() - 1)
     expect(datePipe.transform(notNow, 'relative')).toEqual('1 day ago')
-    notNow.setDate(now.getDate() - 2)
-    expect(datePipe.transform(notNow, 'relative')).toEqual('2 days ago')
+    notNow.setDate(now.getDate())
+    notNow.setMonth(now.getMonth() - 1)
+    expect(datePipe.transform(notNow, 'relative')).toEqual('1 month ago')
     expect(datePipe.transform(now, 'relative')).toEqual('Just now')
   })
 })