ReviewOS

also looking at this

stacks/buddy

test: give the exported VersionResolver its first tests

#1438
Merged glennmichael123 wants to merge test/version-resolver into main
1 file +97 -0
9 days ago

src/version/version-resolver.ts was the last directory on the dossier's zero-coverage list: 82 lines, exported from the package root (export { VersionResolver }), referenced by no test — and called by nothing inside buddy itself, which classifies versions through utils/helpers.getUpdateType instead. For an external consumer of the package, these tests are the only thing standing between the API and silent breakage.

Pinned:

  • compareVersions orders numerically (1.10.0 after 1.2.3), not lexically
  • satisfiesRange caret/tilde semantics
  • getLatestInRange picks the highest satisfying version; null on no match or empty list
  • createRange: operator stripped from range, isExact only without an operator, and the satisfies/getLatest closures resolve against the raw range
  • getUpdateType: first component that grew wins, range operators on either side ignored, short versions pad to major.minor.patch
  • isSafeUpdate: inside the declared range, and an exact pin admits nothing but itself

Found while writing it, flagged not fixed: this is the third parallel getUpdateType implementation (utils/helpers.ts and a private method in buddy.ts are the others). Consolidation is a refactor for another day.

bun test: 2226 pass / 0 fail; typecheck and pickier green.

🤖 Generated with Claude Code

1 changed file on the files tab, with 0 review threads.

Sign in to comment on this pull request.