From 1c2292dde75c24866b22302c57e03fcf211fc3e7 Mon Sep 17 00:00:00 2001 From: Renan Pimentel Date: Thu, 22 Oct 2026 18:01:06 -0300 Subject: [PATCH] test: cover exact year formatting boundary --- src/format.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/format.test.ts b/src/format.test.ts index cdabb0f6..bf62b210 100644 --- a/src/format.test.ts +++ b/src/format.test.ts @@ -1,6 +1,17 @@ import { describe, expect, it } from '@jest/globals'; import { format } from './index'; +describe('format(exact year boundary)', () => { + it('should use years in both formatting modes', () => { + const year = 365.25 * 24 * 60 * 60 * 1000; + + expect(format(year)).toBe('1y'); + expect(format(-year)).toBe('-1y'); + expect(format(year, { long: true })).toBe('1 year'); + expect(format(-year, { long: true })).toBe('-1 year'); + }); +}); + // numbers describe('format(number, { long: true })', () => {