test(domain): add reimbursements logic unit tests#5
Open
LogenNineFingersIsAlive wants to merge 2 commits intomainfrom
Open
test(domain): add reimbursements logic unit tests#5LogenNineFingersIsAlive wants to merge 2 commits intomainfrom
LogenNineFingersIsAlive wants to merge 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves domain-layer testability by extracting reimbursement business rules from reimbursements.service.ts into a pure logic module and adding a dedicated unit test suite, while keeping service behavior unchanged.
Changes:
- Added
reimbursements-logic.tscontaining pure validation/derivation helpers used by the reimbursements service. - Refactored
reimbursements.service.tsto delegate to the extracted helpers. - Added
reimbursements-logic.test.tsunit tests covering reimbursement logic paths.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| packages/domain/src/services/reimbursements.service.ts | Refactors service to call extracted pure helpers (validation, status derivation, auto-match helpers). |
| packages/domain/src/services/reimbursements-logic.ts | New pure business-logic module for reimbursements, intended for unit testing. |
| packages/domain/src/services/tests/reimbursements-logic.test.ts | New Vitest suite covering the extracted reimbursement logic helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/domain/src/services/__tests__/reimbursements-logic.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 2 (part 1) of domain testability: extract and unit-test reimbursements business logic.
What changed
packages/domain/src/services/reimbursements-logic.tspackages/domain/src/services/__tests__/reimbursements-logic.test.tsreimbursements.service.tsto consume extracted pure helpers (no behavior changes intended)Covered logic
none,expected,partial,settled,written_off)Validation
pnpm --filter @tithe/domain typecheckpnpm --filter @tithe/domain test:coveragepnpm lintResults:
reimbursements-logic.tsat 100% statement/branch/function/line coverage