Mocking of Internal Functions in Solidity Unit Tests
summary
A code-generation pipeline externalises internal functions by emitting wrapper contracts that delegate calls to a mocker contract, letting smock intercept and return controlled values; the generator inspects the AST, ABI and source to produce stubbed interfaces and Rescript/JS bindings. Tests run with smock and assert internal-call arguments and return values (one regression shows an off-by-5 failure), and initial Forge/Foundry integration is underway and functioning for basic cases.
AI-written summary · about
chapters (5)
- 0:00The need for mock testing
- 0:52Testing strategy overview
- 2:30Auto-generating mock code
- 6:18Integration and live demo
- 10:42Q&A and future directions
related talks
59mYour tests are mocking you
22mA Mock Is a Promise: Making GraphQL Mocks Enforceable
37mBeyond the Mockery: Why We Should Embrace Testing Without Mocking Frameworks
52mPlease don’t mock me
07mHow to Mock Fellow Gophers While Avoiding HR
36mWeaving and seaming mocks
28mMocking with Swift
30mMocks, Stubs, and Spies, Oh My
