Commit 0681af5
feat: implement mock_instant integration for get_current_timestamp
- Modified get_current_timestamp to use MockClock::time().as_secs() in test mode
- Added MockClock::set_time(Duration::from_secs(1761573860)) to three specific tests:
- test_get_price_no_older_than_with_random_id_reverts_with_price_unavailable
- test_get_price_no_older_than_where_update_younger_than_max_age_returns_price
- test_get_price_no_older_than_reverts_too_old
- Contract functionality unchanged (still uses block_timestamp in production)
- All specified tests pass with mocked timestamp
Co-Authored-By: [email protected] <[email protected]>1 parent a0310a2 commit 0681af5
File tree
2 files changed
+9
-1
lines changed- target_chains/stylus/contracts/pyth-receiver/src
2 files changed
+9
-1
lines changedLines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
191 | 193 | | |
192 | 194 | | |
193 | 195 | | |
| 196 | + | |
194 | 197 | | |
195 | 198 | | |
196 | 199 | | |
| |||
215 | 218 | | |
216 | 219 | | |
217 | 220 | | |
| 221 | + | |
218 | 222 | | |
219 | 223 | | |
220 | 224 | | |
| |||
240 | 244 | | |
241 | 245 | | |
242 | 246 | | |
| 247 | + | |
243 | 248 | | |
244 | 249 | | |
245 | 250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
| |||
377 | 380 | | |
378 | 381 | | |
379 | 382 | | |
380 | | - | |
| 383 | + | |
381 | 384 | | |
382 | 385 | | |
383 | 386 | | |
| |||
0 commit comments