From 76733ca4612655bcca83a58fcf8806893e18d426 Mon Sep 17 00:00:00 2001 From: Foivos Date: Wed, 20 Nov 2024 17:55:42 +0200 Subject: [PATCH] rename assert_single_event to assert_event --- move/axelar_gateway/sources/channel.move | 4 ++-- move/axelar_gateway/sources/gateway.move | 8 ++++---- move/its/sources/events.move | 4 ++-- move/its/sources/its.move | 14 +++++++------- move/utils/sources/utils/utils.move | 6 +++--- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/move/axelar_gateway/sources/channel.move b/move/axelar_gateway/sources/channel.move index df2cdecc..45ad15bd 100644 --- a/move/axelar_gateway/sources/channel.move +++ b/move/axelar_gateway/sources/channel.move @@ -199,9 +199,9 @@ public(package) fun approved_message_payload( fun test_new_and_destroy() { let ctx = &mut sui::tx_context::dummy(); let channel: Channel = new(ctx); - utils::assert_single_event(); + utils::assert_event(); channel.destroy(); - utils::assert_single_event(); + utils::assert_event(); } #[test] diff --git a/move/axelar_gateway/sources/gateway.move b/move/axelar_gateway/sources/gateway.move index b97b9c1d..fe2ebcac 100644 --- a/move/axelar_gateway/sources/gateway.move +++ b/move/axelar_gateway/sources/gateway.move @@ -603,7 +603,7 @@ fun test_take_approved_message() { payload, ); - utils::assert_single_event(); + utils::assert_event(); let expected_approved_message = axelar_gateway::channel::create_approved_message( source_chain, @@ -666,7 +666,7 @@ fun test_approve_messages() { self.approve_messages(bcs::to_bytes(&messages), bcs::to_bytes(&proof)); - utils::assert_single_event(); + utils::assert_event(); clock.destroy_for_testing(); sui::test_utils::destroy(self) @@ -768,7 +768,7 @@ fun test_rotate_signers() { ctx, ); - utils::assert_single_event(); + utils::assert_event(); let data_hash = gateway_v0::rotate_signers_data_hash(next_weighted_signers); let proof = generate_proof( @@ -1053,7 +1053,7 @@ fun test_send_message() { let gateway = dummy(ctx); gateway.send_message(message_ticket); - utils::assert_single_event(); + utils::assert_event(); sui::test_utils::destroy(gateway); channel.destroy(); diff --git a/move/its/sources/events.move b/move/its/sources/events.move index c66a22b8..2569da19 100644 --- a/move/its/sources/events.move +++ b/move/its/sources/events.move @@ -202,7 +202,7 @@ fun test_interchain_transfer_empty_data() { amount, &data, ); - let event = utils::assert_single_event>(); + let event = utils::assert_event>(); assert!(event.data_hash == data_hash); assert!(event.source_address == source_address); @@ -230,7 +230,7 @@ fun test_interchain_transfer_nonempty_data() { amount, &data, ); - let event = utils::assert_single_event>(); + let event = utils::assert_event>(); assert!(event.data_hash == data_hash); assert!(event.source_address == source_address); diff --git a/move/its/sources/its.move b/move/its/sources/its.move index 96fd7cb9..86b2481e 100644 --- a/move/its/sources/its.move +++ b/move/its/sources/its.move @@ -435,7 +435,7 @@ fun test_register_coin() { let coin_management = its::coin_management::new_locked(); register_coin(&mut its, coin_info, coin_management); - utils::assert_single_event>(); + utils::assert_event>(); sui::test_utils::destroy(its); } @@ -463,7 +463,7 @@ fun test_deploy_remote_interchain_token() { destination_chain, ); - utils::assert_single_event>(); + utils::assert_event>(); let mut writer = abi::new_writer(6); @@ -503,7 +503,7 @@ fun test_deploy_interchain_token() { let token_id = register_coin(&mut its, coin_info, coin_management); - utils::assert_single_event>(); + utils::assert_event>(); let amount = 1234; let coin = sui::coin::mint_for_testing(amount, ctx); @@ -527,7 +527,7 @@ fun test_deploy_interchain_token() { &clock, ); - utils::assert_single_event>(); + utils::assert_event>(); let mut writer = abi::new_writer(6); @@ -599,7 +599,7 @@ fun test_receive_interchain_transfer() { receive_interchain_transfer(&mut its, approved_message, &clock, ctx); - utils::assert_single_event>(); + utils::assert_event>(); clock.destroy_for_testing(); sui::test_utils::destroy(its); @@ -661,7 +661,7 @@ fun test_receive_interchain_transfer_with_data() { ctx, ); - utils::assert_single_event>(); + utils::assert_event>(); assert!(received_source_chain == source_chain); assert!(received_source_address == its_source_address); @@ -710,7 +710,7 @@ fun test_receive_deploy_interchain_token() { receive_deploy_interchain_token(&mut its, approved_message); - utils::assert_single_event>(); + utils::assert_event>(); clock.destroy_for_testing(); sui::test_utils::destroy(its); diff --git a/move/utils/sources/utils/utils.move b/move/utils/sources/utils/utils.move index 206fe24f..e5b57ac8 100644 --- a/move/utils/sources/utils/utils.move +++ b/move/utils/sources/utils/utils.move @@ -33,14 +33,14 @@ public macro fun peel<$T>($data: vector, $peel_fn: |&mut BCS| -> $T): $T { use sui::event; #[test_only] -public fun assert_events(n: u64): vector { +public fun assert_events(event_count: u64): vector { let events = event::events_by_type(); - assert!(events.length() == n); + assert!(events.length() == event_count); events } #[test_only] -public fun assert_single_event(): T { +public fun assert_event(): T { let events = assert_events(1); events[0] }