Skip to content

Improve test coverage#91

Merged
InteractionEngineer merged 3 commits into
mainfrom
improve-test-coverage
May 14, 2026
Merged

Improve test coverage#91
InteractionEngineer merged 3 commits into
mainfrom
improve-test-coverage

Conversation

@InteractionEngineer
Copy link
Copy Markdown
Owner

I plan to improve the app and need to do some significant amount of changes to the infrastructure (especially likely to combine) eventually. Real people depend on this single client on the iOS platform and one of my highest goals is to only increase the value PayForMe brings to them and therefore prevent introducing new bugs. That's why one of my first bigger contribution to this codebase are many unit tests that ensure the current (correct) behavior of the app.

Changes were co-authored by Claude Sonnet 4.6 High and every line of code was manually reviewed, and altered if needed, by a real human (me).

Covers Bill params, JSON decoding, balance calculation, bill sorting, network request contracts (Cospend + iHateMoney), URL scheme decoding,and AddProjectManually URL normalization.
@InteractionEngineer InteractionEngineer self-assigned this May 13, 2026
Copilot AI review requested due to automatic review settings May 13, 2026 23:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a substantial unit-testing safety net for PayForMe before larger refactors. It introduces shared test helpers, expands existing URL/AddProject tests with clearer naming and richer assertions, and adds new test suites covering URL request building, JSON decoding, bill parameter generation, sort modes, and balance calculation. A stray copyright line is also removed from ShareProjectQRCodeViewModel.swift.

Changes:

  • New test files: TestHelpers (mock URL protocol + fixtures), NetworkRequestTests, JSONDecodingTests, BillTests, BillSortingTests, BalanceCalculationTests.
  • Existing UrlExtensionsTests and AddProjectManuallyTests are simplified, renamed for intent, and given explanatory comments.
  • Xcode project updated to include the new test files in the test target.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
PayForMeTests/TestHelpers.swift Adds MockURLProtocol and Project/Bill/Person fixtures used across new tests.
PayForMeTests/NetworkRequestTests.swift Verifies URL paths, auth headers, and HTTP methods for both backends via MockURLProtocol.
PayForMeTests/JSONDecodingTests.swift Decodes representative server payloads into Bill, Person, and APIProject.
PayForMeTests/BillTests.swift Asserts backend-specific shape of Bill.paramsFor and Bill.newBill() defaults.
PayForMeTests/BillSortingTests.swift Covers BillListViewModel.SortedBy.sort for both modes and edge cases.
PayForMeTests/BalanceCalculationTests.swift Validates BalanceViewModel.setBalances() math, including the zero-sum invariant.
PayForMeTests/UrlExtensionsTests.swift Tightens existing tests and adds QR-dispatch and malformed-URL coverage.
PayForMeTests/AddProjectManuallyTests.swift Renames tests for clarity and documents debounce timing.
PayForMe/Views/Projects/ShareProjectQRCodeViewModel.swift Removes a single copyright line from the file header.
PayForMe.xcodeproj/project.pbxproj Wires the new test files into the test target.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread PayForMeTests/NetworkRequestTests.swift Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@InteractionEngineer InteractionEngineer merged commit cf452ee into main May 14, 2026
1 check passed
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.

2 participants