Skip to content

Commit 9f18ada

Browse files
kaze-cowclaude
andcommitted
refactor: improve CowEvcClosePositionWrapper test suite DRYness
Refactor CowEvcClosePositionWrapper test files to reduce code duplication and improve maintainability: Integration tests (CowEvcClosePositionWrapper.t.sol): - Add helper functions for common test setup patterns - _createDefaultParams(): standardized param creation - _setupClosePositionApprovals(): approval setup for close position - _setupPreApprovedFlow(): pre-approved hash flow setup - _createPermitSignature(): permit signature creation - _encodeWrapperData(): wrapper data encoding - _executeWrappedSettlement(): settlement execution - Add DEFAULT_SELL_AMOUNT and DEFAULT_BUY_AMOUNT constants - Reduce test function size significantly while maintaining clarity Unit tests (CowEvcClosePositionWrapper.unit.t.sol): - Add helper functions for common patterns - _getDefaultParams(): returns default params (tests modify as needed) - _getEmptySettleData(): creates empty settlement data - _getSettleDataWithTokens(): creates settlement data with tokens/prices - _encodeWrapperData(): wrapper data encoding - _setupPreApprovedHash(): pre-approved hash setup - Add DEFAULT_REPAY_AMOUNT and KIND_BUY constants - Remove 5 redundant tests with no coverage impact: - test_Constructor_SetsName (trivial getter) - test_GetApprovalHash_Consistency (deterministic function) - test_ParseWrapperData_WithSignature (duplicate code path) - test_GetSignedCalldata_FullRepay (covered by other tests) - test_GetSignedCalldata_ContainsRepayItem (duplicate of RepayItem) - Reduce from 32 to 27 unit tests with no loss in coverage All tests pass: 7/7 integration tests, 27/27 unit tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent f312246 commit 9f18ada

File tree

2 files changed

+294
-536
lines changed

2 files changed

+294
-536
lines changed

0 commit comments

Comments
 (0)