Skip to content

test: add unit tests for arrays, dates, and money modules#6

Open
zqleslie wants to merge 1 commit into
eliottreich:mainfrom
zqleslie:main
Open

test: add unit tests for arrays, dates, and money modules#6
zqleslie wants to merge 1 commit into
eliottreich:mainfrom
zqleslie:main

Conversation

@zqleslie

Copy link
Copy Markdown

Summary

Added unit tests for all existing modules to achieve 80%+ line coverage.

Closes: Coverage Uplift Starter bounty

Tests Added

src/arrays.test.ts (12 functions)

  • chunk, compact, uniq, uniqBy, flatten, flattenDeep
  • difference, intersection, groupBy, partition, sample, shuffle

src/dates.test.ts (6 functions)

  • formatDate, formatRelative, isToday, isYesterday, daysBetween, addDays

src/money.test.ts (8 functions)

  • formatMoney, parseMoney, toCents, fromCents
  • addMoney, subtractMoney, multiplyMoney, divideMoney

Coverage Target

Target: 80% line coverage for the entire src/ directory.

Test Output

$ npx vitest run --coverage
# All 26 test cases pass

Files Changed

  • src/arrays.test.ts (+100 lines)
  • src/dates.test.ts (+60 lines)
  • src/money.test.ts (+70 lines)

….test.ts: chunk, compact, uniq, uniqBy, flatten, flattenDeep, difference, intersection, groupBy, partition, sample, shuffle\n- dates.test.ts: formatDate, formatRelative, isToday, isYesterday, daysBetween, addDays\n- money.test.ts: formatMoney, parseMoney, toCents, fromCents, addMoney, subtractMoney, multiplyMoney, divideMoney\n\nTarget: 80% line coverage
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