diff --git a/crates/dojo-core/src/world_test.cairo b/crates/dojo-core/src/world_test.cairo index 8e821b3ea0..9a887d5d5b 100644 --- a/crates/dojo-core/src/world_test.cairo +++ b/crates/dojo-core/src/world_test.cairo @@ -619,18 +619,24 @@ fn test_set_facts_registry() { assert(facts_registry == contract_address_const::<0x875914875149357>(), 'invalid program hash'); } +fn drop_all_events(address: ContractAddress) { + loop { + match starknet::testing::pop_log_raw(address) { + option::Option::Some(_) => {}, + option::Option::None => { break; }, + }; + } +} #[test] #[available_gas(6000000)] fn test_program_hash_event_emit() { let world = deploy_world(); + drop_all_events(world.contract_address); let config = IConfigDispatcher { contract_address: world.contract_address }; config.set_program_hash(program_hash: 98758347158781475198374598718743); - // pop value from the logs for the assertion to pass - let _: Option = starknet::testing::pop_log(world.contract_address); - assert_eq!(starknet::testing::pop_log(world.contract_address), Option::Some(ProgramHashUpdate { program_hash: 98758347158781475198374598718743 })); } @@ -638,13 +644,11 @@ fn test_program_hash_event_emit() { #[available_gas(6000000)] fn test_facts_registry_event_emit() { let world = deploy_world(); + drop_all_events(world.contract_address); let config = IConfigDispatcher { contract_address: world.contract_address }; config.set_facts_registry(contract_address_const::<0x12>()); - // pop value from the logs for the assertion to pass - let _: Option = starknet::testing::pop_log(world.contract_address); - assert_eq!(starknet::testing::pop_log(world.contract_address), Option::Some(FactsRegistryUpdate{ address: contract_address_const::<0x12>()})); }