Closed jayy04 closed 3 months ago
The updates across multiple test files in this refactor primarily involve standardizing the creation of asset and perpetual positions using helper functions from a utility package (testutil
). This modification not only simplifies the test setup code but also enhances readability and maintenance by centralizing test data structure creation.
Files/Paths | Change Summary |
---|---|
protocol/daemons/liquidation/client/sub_task_runner_test.go | Replaced direct assignments for positions with calls to testutil.CreateSingleAssetPosition and testutil.CreateSinglePerpetualPosition . |
protocol/x/clob/client/cli/liquidations_cli_test.go | Updated import statements; utilized new parameters in testutil.CreateSingleAssetPosition and testutil.CreateSinglePerpetualPosition . |
protocol/x/clob/e2e/ -> app_test.go, conditional_orders_test.go, isolated_subaccount_orders_test.go, liquidation_deleveraging_test.go, long_term_orders_test.go, reduce_only_orders_test.go, short_term_orders_test.go, withdrawal_gating_test.go | Unified position creation using testutil functions across multiple e2e test files. |
protocol/x/clob/keeper/ -> deleveraging_test.go, liquidations_test.go, msg_server_place_order_test.go, process_operations_liquidations_test.go, process_operations_long_term_test.go, process_operations_test.go | Refactored position initialization via testutil functions to streamline asset and perpetual position setups. |
protocol/x/sending/app_test.go | Introduced testutil for creating asset positions using CreateSingleAssetPosition . |
protocol/x/subaccounts/ -> keeper/isolated_subaccount_test.go, lib/oimf_test.go, lib/updates_test.go, types/genesis_test.go, types/subaccount_test.go | Replaced custom position creation logic with testutil functions to handle position creation more efficiently. |
protocol/x/vault/keeper/ -> grpc_query_vault_test.go, msg_server_deposit_to_vault_test.go, orders_test.go | Simplified position creation in tests by importing testutil and using appropriate helper functions. |
To structure tests, we made a call,
Withtestutil
, positions sprawl.
From clob to subaccounts, a unified way,
Refactoring makes the code obey.
Tests now simpler, clear, precise,
Our codebase earns a fresh device.
Centralized logic, oh what a gift,
Now test with ease, give code a lift!
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Changelist
[Describe or list the changes made in this PR]
Test Plan
[Describe how this PR was tested (if applicable)]
Author/Reviewer Checklist
state-breaking
label.indexer-postgres-breaking
label.PrepareProposal
orProcessProposal
, manually add the labelproposal-breaking
.feature:[feature-name]
.backport/[branch-name]
.refactor
,chore
,bug
.Summary by CodeRabbit