Add comprehensive unit tests for core financial calculation library - #19
Conversation
Co-authored-by: frouaix <876178+frouaix@users.noreply.github.com>
Co-authored-by: frouaix <876178+frouaix@users.noreply.github.com>
Co-authored-by: frouaix <876178+frouaix@users.noreply.github.com>
|
@copilot check and fix lint, build and test errors |
Co-authored-by: frouaix <876178+frouaix@users.noreply.github.com>
Fixed all lint, build, and test errors in commit 1dc4a04: ✅ Lint: Removed unused imports, unused variables, and replaced All checks now pass successfully. |
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive unit test coverage for the core financial calculation library (src/lib) and utility functions (src/utils), achieving 330 passing tests that exceed the original 325-test goal mentioned in the README. The tests validate critical retirement planning calculations including tax computations, RMD calculations, and account withdrawal logic.
Changes:
- Created 9 new test files covering all business logic in
src/libandsrc/utilsdirectories - Tests validate IRS 2024 tax brackets, SECURE Act 2.0 RMD rules, and Big.js precision arithmetic
- Includes edge case testing, realistic retirement scenarios, and comprehensive validation of account withdrawal mechanics
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/validation.test.ts | 21 tests for user profile and account data validation functions |
| src/tests/taxCalculator.test.ts | 26 tests covering federal tax calculations, LTCG/QD stacking, and Social Security taxation with IRS 2024 parameters |
| src/tests/rmdCalculator.test.ts | 48 tests for SECURE Act 2.0 RMD calculations with IRS Uniform Lifetime Table validation |
| src/tests/ids.test.ts | 7 tests for unique ID generation using crypto.randomUUID with fallback handling |
| src/tests/format.test.ts | 19 tests for currency formatting utilities with and without cents |
| src/tests/TraditionalAccount.test.ts | 43 tests for traditional IRA/401(k) with RMD enforcement and ordinary income taxation |
| src/tests/TaxableAccount.test.ts | 43 tests for taxable brokerage accounts with cost basis tracking and proportional LTCG calculation |
| src/tests/RothAccount.test.ts | 39 tests for Roth accounts with tax-free withdrawals and no RMD requirements |
Comprehensive Tests for Core Library - COMPLETE ✅
Project Summary
Successfully created comprehensive unit test coverage for all logic in
src/libandsrc/utilsdirectories, exceeding the original 325-test goal mentioned in the README.Test Files Created
Core Library Tests (src/lib/) - ✅ COMPLETE
Utility Tests (src/utils/) - ✅ COMPLETE
Final Test Count: 330 Tests Passing 🎉
Exceeds the 325-test target mentioned in README.md
Latest Fix (commit hash will be added)
Fixed all lint, build, and test errors:
anytype casts with properunknowntype assertions in validation.test.tsTest Coverage Highlights
Tax Calculator (26 tests)
RMD Calculator (48 tests)
Account Classes (125 tests total)
Utilities (47 tests)
Test Quality
All Tests Passing
Mission accomplished! 🚀
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.