feat: add comprehensive test for PythReceiver initialize function #2825
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.
feat: add comprehensive test for PythReceiver initialize function
Summary
Added a complete integration test for the
PythReceiver::initializefunction in the Stylus framework. The test creates valid parameter instances for all initialize function inputs (wormhole address, fees, data sources, governance config) and verifies successful initialization through getter method calls.Key changes:
integration_tests.rs(added missingPythReceiverandU256imports)TestVM::default()and proper error handlingReview & Testing Checklist for Human
get_update_fee(),get_twap_update_fee(), andget_price_unsafe()actually proves initialization worked correctlycargo test --lib integration_testslocally to verify compilation and test successDiagram
%%{ init : { "theme" : "default" }}%% graph TD subgraph "Stylus Contract Structure" lib["src/lib.rs<br/>PythReceiver impl"]:::context integration["src/integration_tests.rs<br/>test_initialize()"]:::major-edit structs["src/structs.rs<br/>Data structures"]:::context end subgraph "Test Flow" vm["TestVM::default()"]:::context contract["PythReceiver::from(&vm)"]:::context params["Test Parameters<br/>(addresses, fees, etc.)"]:::major-edit initialize["contract.initialize(...)"]:::major-edit verify["Verification Assertions<br/>(get_update_fee, etc.)"]:::major-edit end integration --> vm vm --> contract contract --> params params --> initialize initialize --> verify lib --> integration subgraph Legend L1["Major Edit"]:::major-edit L2["Minor Edit"]:::minor-edit L3["Context/No Edit"]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes