Skip to content

Test exact one-year formatting boundary - #302

Open
renanmpimentel wants to merge 1 commit into
vercel:mainfrom
renanmpimentel:test/exact-year-boundary
Open

renanmpimentel wants to merge 1 commit into
vercel:mainfrom
renanmpimentel:test/exact-year-boundary

Conversation

@renanmpimentel

@renanmpimentel renanmpimentel commented Oct 22, 2026 •

Copy link
Copy Markdown

Why this test matters

A strict > comparison at exactly 365.25 days would format one year as 12mo rather than 1y. The new cases protect the equality boundary in short and long formats for both signs.

Supertest audit method

I used the Supertest test-audit skill to probe whether the existing suite would catch a plausible violation of this contract. The regression was applied only in an isolated worktree. The regression proof records three executed states: the existing tests pass with that regression, the new assertion fails against the same regression, and the new test passes with the original production code restored. The published diff adds tests only.

Change and verification

Summary

Test the exact one-year threshold in both short and long formatting, for positive and negative values. Existing year tests use a value one millisecond above the threshold, so they do not protect the comparison at equality.

Regression proof

In an isolated worktree, changing both year checks from >= to > left the unchanged Node.js and Edge suites green (167 tests in each). With this test added, the same regression fails by assertion: exactly one year formats as 12mo instead of 1y. Restoring production code passes both suites (168 tests in each).

Verification

  • pnpm lint — passed
  • pnpm typecheck — passed
  • biome ci src/format.test.ts — passed
  • pnpm test — 168 tests passed in Node.js and 168 in Edge
  • git diff --check — passed

The permanent diff is limited to src/format.test.ts.

Repository guidance

No contribution guide or PR template was present in the audited checkout. The project lint, typecheck, Biome check, and Node/Edge tests passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant