Skip to content

Commit 561be32

Browse files
committed
added new governance tests, set valid data sources not working yet though
1 parent 2aae277 commit 561be32

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

target_chains/stylus/contracts/pyth-receiver/src/pyth_governance_test.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,42 @@ mod test {
106106
.execute_governance_instruction(bytes.clone());
107107
assert!(result.is_ok());
108108
}
109+
110+
#[motsu::test]
111+
fn test_set_valid_period(
112+
pyth_contract: Contract<PythReceiver>,
113+
wormhole_contract: Contract<WormholeContract>,
114+
alice: Address,
115+
) {
116+
pyth_wormhole_init(&pyth_contract, &wormhole_contract, &alice, 0);
117+
118+
let hex_str = "010000000001006fc16df905b08c16553eda9d5a7898ec7eba4267ce0af7945625c955e8f435fc7df7a4087af360f88c2477f0c2f4e7eaa4bb1e8fd43677f4d6b04ee20e225186000000000100000000000100000000000000000000000000000000000000000000000000000000000000110000000000000001005054474d010400020000000000000000";
119+
let bytes = Vec::from_hex(hex_str).expect("Invalid hex string");
120+
121+
let result = pyth_contract
122+
.sender(alice)
123+
.execute_governance_instruction(bytes.clone());
124+
125+
println!("Result: {:?}", result.unwrap_err());
126+
// assert!(result.is_ok());
127+
}
128+
129+
#[motsu::test]
130+
fn test_set_fee(
131+
pyth_contract: Contract<PythReceiver>,
132+
wormhole_contract: Contract<WormholeContract>,
133+
alice: Address,
134+
) {
135+
pyth_wormhole_init(&pyth_contract, &wormhole_contract, &alice, 0);
136+
137+
let hex_str = "0100000000010057940f58a6a44c93606bd721701539e0da93d5ea1583a735fbb13ecbcf9c01fc70240de519ea76869af14d067d68c5f3f2230f565f41b7009f3c3e63749353ed000000000100000000000100000000000000000000000000000000000000000000000000000000000000110000000000000001005054474d0103000200000000000000050000000000000003";
138+
let bytes = Vec::from_hex(hex_str).expect("Invalid hex string");
139+
140+
let result = pyth_contract
141+
.sender(alice)
142+
.execute_governance_instruction(bytes.clone());
143+
144+
assert!(result.is_ok());
145+
// println!("Result: {:?}", result.unwrap_err());
146+
}
109147
}

0 commit comments

Comments
 (0)