fix: correct pre-existing test mocking issues#13
Closed
b-l-u-e wants to merge 1 commit into2140-dev:masterfrom
Closed
fix: correct pre-existing test mocking issues#13b-l-u-e wants to merge 1 commit into2140-dev:masterfrom
b-l-u-e wants to merge 1 commit into2140-dev:masterfrom
Conversation
Backend: estimate_smart_fee issues multiple RPC calls internally; use side_effect and filter call_args_list for the right call. Frontend: accept optional baseUrl in API constructor so test suite uses the injected mock URL.
Collaborator
|
Thanks for the fix. This is fixed now. |
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 fixes two unrelated test issues so the suite runs reliably without false failures.
1. Backend:
test_clamps_target_in_rpc_call(RPC service)problem: The test mocks
_rpc_callwith a singlereturn_value.estimate_smart_fee()performs several RPC calls internally (estimatesmartfee,getblockchaininfo,getblockcount,getmempoolfeeratediagram,getblockstats).mock.call_argsrefers to the last call, not theestimatesmartfeecall, so the assertion on the clamped target can raise or assert the wrong thing.Error observed:
2. Frontend: API constructor
problem:
BitcoinCoreAPIdid not accept abaseUrlargument. Tests passnew BitcoinCoreAPI('http://test-api:5001')so thatfetchis mocked against that URL, but the argument was ignored and the client used/api, so assertions on the request URL fail and tests hit the real proxy instead of the mock.Error observed: