Skip to content

test: add missing month parsing and zero value coverage#287

Open
mahmoodhamdi wants to merge 1 commit intovercel:mainfrom
mahmoodhamdi:test/month-and-zero-coverage
Open

test: add missing month parsing and zero value coverage#287
mahmoodhamdi wants to merge 1 commit intovercel:mainfrom
mahmoodhamdi:test/month-and-zero-coverage

Conversation

@mahmoodhamdi
Copy link
Copy Markdown

Summary

While working with ms for cache TTL logic, I noticed the test suite has a gap: the ms(string) and ms(long string) sections test every supported unit except months. The mo/month/months unit is tested in parse.test.ts and parse-strict.test.ts, but not through the main ms() entry point.

Also, zero-value behavior was completely untested.

Tests Added

Month parsing via ms():

  • ms('1mo')2629800000
  • ms('1 month')2629800000

Zero values:

  • ms('0')0
  • ms('0ms') / ms('0s') / ms('0h')0
  • ms(0)'0ms'
  • ms(0, { long: true })'0 ms'

Checks

  • pnpm test — 173 tests pass (Node.js + Edge Runtime)
  • pnpm typecheck — clean
  • pnpm lint — clean
  • 100% code coverage maintained

No code changes — tests only.

The ms(string) and ms(long string) test sections cover every unit
(y, w, d, h, m, s, ms) except months — even though months are
supported since v3 and tested in parse.test.ts. This adds the
missing cases through the main ms() entry point.

Also adds zero-value tests (ms('0'), ms('0ms'), ms(0), ms(0, {long}))
which were previously untested.
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