@@ -8,7 +8,6 @@ use apollo_l1_provider::event_identifiers_to_track;
88use apollo_l1_provider:: l1_scraper:: L1Scraper ;
99use apollo_l1_provider_types:: { Event , MockL1ProviderClient } ;
1010use apollo_l1_scraper_config:: config:: L1ScraperConfig ;
11- use mockall:: predicate:: eq;
1211use mockall:: Sequence ;
1312use papyrus_base_layer:: test_utils:: DEFAULT_ANVIL_L1_ACCOUNT_ADDRESS ;
1413use papyrus_base_layer:: BaseLayerContract ;
@@ -20,6 +19,15 @@ use starknet_api::hash::StarkHash;
2019use starknet_api:: transaction:: fields:: { Calldata , Fee } ;
2120use starknet_api:: transaction:: { L1HandlerTransaction , TransactionHasher , TransactionVersion } ;
2221
22+ fn check_events_eq ( expected : & [ Event ] , actual : & [ Event ] ) -> bool {
23+ if expected != actual {
24+ println ! ( "Expected: {expected:?}\n Actual: {actual:?}" ) ;
25+ return false ;
26+ }
27+
28+ true
29+ }
30+
2331#[ tokio:: test]
2432async fn scraper_end_to_end ( ) {
2533 // Setup.
@@ -137,15 +145,22 @@ async fn scraper_end_to_end() {
137145
138146 let mut sequence = Sequence :: new ( ) ;
139147 // Expect first call to return all the events defined further down.
148+ let expected_events_first_call =
149+ [ first_expected_log, second_expected_log, expected_cancel_message] ;
140150 l1_provider_client
141151 . expect_add_events ( )
142152 . once ( )
143153 . in_sequence ( & mut sequence)
144- . with ( eq ( vec ! [ first_expected_log , second_expected_log , expected_cancel_message ] ) )
154+ . withf ( move |actual| check_events_eq ( & expected_events_first_call , actual ) )
145155 . returning ( |_| Ok ( ( ) ) ) ;
146156
147157 // Expect second call to return nothing, no events left to scrape.
148- l1_provider_client. expect_add_events ( ) . once ( ) . in_sequence ( & mut sequence) . returning ( |_| Ok ( ( ) ) ) ;
158+ l1_provider_client
159+ . expect_add_events ( )
160+ . once ( )
161+ . in_sequence ( & mut sequence)
162+ . withf ( move |actual| check_events_eq ( & [ ] , actual) )
163+ . returning ( |_| Ok ( ( ) ) ) ;
149164
150165 let l1_scraper_config = L1ScraperConfig {
151166 // Start scraping far enough back to capture all of the events created before.
0 commit comments