Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[trello.com/c/dmJg0inY]: DogeWalletService tests #658

Merged
merged 2 commits into from
Jan 30, 2025

Conversation

ChrisBenua
Copy link
Member

Initially open PR to EthWalletService tests branch to minimise diff.

Used only two hacks:

  1. DogeWallet raw initializer (marked it as deprecated with message "For testing purposes only" and made it available only in DEBUG builds)
  2. DogeWalletService.setWalletForTests - method to set wallet easily for testing purposes, (marked it as deprecated with message "For testing purposes only" and made it available only in DEBUG builds)

In tests I caught every custom error thrown by createTransaction method, verified that parameters passed to BitcoinKit.Transaction.createTransactions are expected.

PR is very similar to BtcWalletServiceTest but has some unique caveats to workaround:

  1. To use mocks for DogeApiService protocol DogeApiServiceProtocol was introduced, but I had to slightly change internals of DogeApiService to match protocol requirements (public interface didn't change)
  2. DogeApiServiceProtocolMock redirect all calls to _api property, also api property (introduced to match protocol requirement) redirects all calls to _api, so whenever DogeWalletService calls network request using either dogeApiService.request or dogeApiService.api.request - we don't need extra mocks for each case

@ChrisBenua ChrisBenua self-assigned this Jan 20, 2025
@ChrisBenua ChrisBenua force-pushed the dev/trello.com/c/rxAVDtVH branch 2 times, most recently from 6e98454 to 79666b9 Compare January 24, 2025 20:35
Base automatically changed from dev/trello.com/c/rxAVDtVH to develop January 24, 2025 20:40
@ChrisBenua ChrisBenua force-pushed the trello.com/c/dmJg0inY branch from a3e5e2f to 8dbf57e Compare January 24, 2025 20:48
@ChrisBenua ChrisBenua force-pushed the trello.com/c/dmJg0inY branch from 91421f7 to 3d27b5c Compare January 30, 2025 19:26
@ChrisBenua ChrisBenua merged commit 8f16540 into develop Jan 30, 2025
@ChrisBenua ChrisBenua deleted the trello.com/c/dmJg0inY branch January 30, 2025 19:28
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.

3 participants