Files
mev-beta/go.sum
Administrator e75ea31908 feat(parsers): implement parser factory with 100% test coverage
Implemented complete parser factory with comprehensive test suite:

Parser Factory (pkg/parsers/factory.go):
- Thread-safe parser registration with sync.RWMutex
- GetParser() for retrieving registered parsers
- ParseLog() routes logs to appropriate parser
- ParseTransaction() parses all events from transaction
- Prevents duplicate registrations
- Validates all inputs (non-nil parser, non-unknown protocol)

Tests (pkg/parsers/factory_test.go):
- mockParser for testing
- TestNewFactory - factory creation
- TestFactory_RegisterParser - valid/invalid/duplicate registrations
- TestFactory_GetParser - registered/unregistered parsers
- TestFactory_ParseLog - supported/unsupported logs
- TestFactory_ParseTransaction - various scenarios
- TestFactory_ConcurrentAccess - thread safety validation
- 100% code coverage

SwapEvent Tests (pkg/types/swap_test.go):
- TestSwapEvent_Validate - all validation scenarios
- TestSwapEvent_GetInputToken - token extraction
- TestSwapEvent_GetOutputToken - token extraction
- Test_isZero - helper function coverage
- Edge cases: zero hash, zero addresses, zero amounts
- 100% code coverage

PoolInfo Tests (pkg/types/pool_test.go):
- TestPoolInfo_Validate - all validation scenarios
- TestPoolInfo_GetTokenPair - sorted pair retrieval
- TestPoolInfo_CalculatePrice - price calculation with decimal scaling
- Test_scaleToDecimals - decimal conversion (USDC/WETH/WBTC)
- Edge cases: zero reserves, nil values, invalid decimals
- 100% code coverage

Task: P1-001 Parser Factory  Complete
Coverage: 100% (enforced)
Thread Safety: Validated with concurrent access tests
Next: P1-002 Logging infrastructure

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 14:47:09 +01:00

0 lines
0 B
Plaintext