Skip to content

Commit

Permalink
check for events
Browse files Browse the repository at this point in the history
  • Loading branch information
Foivos committed Nov 20, 2024
1 parent f874c10 commit 8f716bc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
7 changes: 6 additions & 1 deletion move/axelar_gateway/sources/channel.move
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ public(package) fun create_approved_message(
// ---------
// Test Only
// ---------
#[test_only]
use utils::utils;

#[test_only]
public fun new_approved_message(
source_chain: String,
Expand Down Expand Up @@ -196,7 +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);
channel.destroy()
utils::single_event<events::ChannelCreated>();
channel.destroy();
utils::single_event<events::ChannelDestroyed>();
}

#[test]
Expand Down
14 changes: 14 additions & 0 deletions move/axelar_gateway/sources/gateway.move
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ fun version_control(): VersionControl {
use sui::bcs;
#[test_only]
use axelar_gateway::auth::generate_proof;
#[test_only]
use axelar_gateway::events;

#[test_only]
public fun create_for_testing(
Expand Down Expand Up @@ -600,6 +602,9 @@ fun test_take_approved_message() {
destination_id,
payload,
);

utils::single_event<events::MessageExecuted>();

let expected_approved_message = axelar_gateway::channel::create_approved_message(
source_chain,
message_id,
Expand Down Expand Up @@ -661,6 +666,8 @@ fun test_approve_messages() {

self.approve_messages(bcs::to_bytes(&messages), bcs::to_bytes(&proof));

utils::single_event<events::MessageApproved>();

clock.destroy_for_testing();
sui::test_utils::destroy(self)
}
Expand Down Expand Up @@ -761,6 +768,8 @@ fun test_rotate_signers() {
ctx,
);

utils::single_event<events::SignersRotated>();

let data_hash = gateway_v0::rotate_signers_data_hash(next_weighted_signers);
let proof = generate_proof(
data_hash,
Expand All @@ -777,6 +786,8 @@ fun test_rotate_signers() {
ctx,
);

utils::multiple_events<events::SignersRotated>(2);

clock.destroy_for_testing();
sui::test_utils::destroy(self);
}
Expand Down Expand Up @@ -1041,6 +1052,9 @@ fun test_send_message() {

let gateway = dummy(ctx);
gateway.send_message(message_ticket);

utils::single_event<events::ContractCall>();

sui::test_utils::destroy(gateway);
channel.destroy();
}

0 comments on commit 8f716bc

Please sign in to comment.