Add comprehensive test coverage for WealthsimpleAccount#258
Merged
Conversation
Co-authored-by: Nef10 <4551135+Nef10@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add Test coverage for WealthsimpleAccount struct
Add comprehensive test coverage for WealthsimpleAccount struct
Sep 2, 2025
|
Minimum coverage required: 30%
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
This PR adds comprehensive test coverage for the
WealthsimpleAccountstruct, following the established pattern fromTokenTests. The implementation includes 18 new test cases that thoroughly exercise all public methods and error handling paths.What's Added
New Test File:
WealthsimpleAccountTests.swiftWealthsimpleAccount.getAccounts()MockURLProtocolto support the/accountsendpointTest Coverage
Successful Scenarios (2 tests)
ca_tfsa,ca_rrsp,ca_cash_msb,ca_cash,ca_non_registeredNetwork & HTTP Error Handling (4 tests)
URLError.networkConnectionLost)HTTPURLResponse)JSON Parsing Error Coverage (5 tests)
results,object)objecttype)Individual Account Validation (6 tests)
id,type,base_currency,custodian_account_number)Edge Cases (1 test)
Technical Implementation
The tests follow the same patterns established in
TokenTests:MockURLProtocolfor network request interceptionMockCredentialStorageXCTestExpectationfor async testingAccountErrorenum casesError Coverage
All
AccountErrorcases are tested:noDataReceivedhttpError(error: String)invalidJson(error: String)invalidJsonType(json: Any)missingResultParamenter(json: [String: Any])invalidResultParamenter(json: [String: Any])tokenError(_ error: TokenError)Test Results
The implementation provides thorough validation of the
WealthsimpleAccountstruct's behavior under both normal and error conditions, ensuring robust error handling and proper data parsing.Fixes #257.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.